Of course... Thanks -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 Lab cell 925-724-7509 On 5/11/18, 3:50 PM, "R-help on behalf of peter dalgaard" <r-help-boun...@r-project.org on behalf of pda...@gmail.com> wrote:
Um, maybe just dat1$C <- match(dat1$B, unique(dat1$B)) Indexing 1:k with numbers between 1 and k is a bit of a no-op... AFAICT, this even works without stringsAsFactors=FALSE -pd > On 11 May 2018, at 21:30 , MacQueen, Don <macque...@llnl.gov> wrote: > > dat1$C <- seq(length(unique(dat1$B)))[ match( dat1$B, unique(dat1$B) )] -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd....@cbs.dk Priv: pda...@gmail.com ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.