Yes. My understanding is that you want the identifier to have the same
number of rows as the data frame. A slight variant of David's solution
would then be:
do.call(paste0,x)
-- Bert
On Mon, Sep 18, 2017 at 8:29 AM, David Winsemius
wrote:
>
> > On Sep 18, 2017, at 5:13 AM, Therneau, Terry M
> On Sep 18, 2017, at 5:13 AM, Therneau, Terry M., Ph.D.
> wrote:
>
> This question likely has a 1 line answer, I'm just not seeing it. (2, 3, or
> 10 lines is fine too.)
>
> For a vector I can do group <- match(x, unqiue(x)) to get a vector that
> labels each element of x.
> What is an eq
You could use merge() with an ID column pasted onto the table of names, as
in
> tbl <- data.frame(FirstName=c("Abe","Abe","Bob","Chuck","Chuck"),
Surname=c("Xavier","Yates","Yates","Yates","Zapf"), Id=paste0("P",101:105))
> tbl
FirstName Surname Id
1 Abe Xavier P101
2 Abe Yates
Hi!
2017-09-18 07:13 -0500, Therneau, Terry M., Ph.D. wrote:
> This question likely has a 1 line answer, I'm just not seeing
> it. (2, 3, or 10 lines is
> fine too.)
>
> For a vector I can do group <- match(x, unqiue(x)) to get a vector
> that labels each
> element of x.
Actually, you get a v
"Label" is not a clear term for data frames, but most data frames have
rownames. If dta is a data frame, not a tibble,
rownames( dta )[ !duplicated( dta ) ]
Or could use row indexes directly
which( !duplicated( dta ) )
--
Sent from my phone. Please excuse my brevity.
On September 18, 2017 6
Hi Terry,
I take your question to mean how to label distinct rows of a data frame. If
that is not your question please clarify.
I found the row.match() function in the package prodlim that can be used to
solve this.
However since your request requires no additional dependencies I borrowed
the relev
This question likely has a 1 line answer, I'm just not seeing it. (2, 3, or 10 lines is
fine too.)
For a vector I can do group <- match(x, unqiue(x)) to get a vector that labels each
element of x.
What is an equivalent if x is a data frame?
The result does not have to be fast: the data set
7 matches
Mail list logo