[R] What is the correct way of using function C() for factors:

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Feb 5 20:45:29 CET 2004


Did you mean the function c() or the function(C)?  They are not the same 
thing!

Also,  R does not have `strings' but it does have character vectors.

On Thu, 5 Feb 2004, Corey Moffet wrote:

> try:
> 
> l <- factor(c('a','b'))
> l
> 
> At 12:15 PM 2/5/2004 -0600, Svetlana Eden wrote:
> >
> >The funciton c() works differently for strings and for factors:
> >
> >
> >For strings:
> >
> >> l = c('a', 'b')
> >> l
> >[1] "a" "b"
> >
> >
> >For factors:
> >
> >> l = c(factor('a'), factor('b'))
> >> l
> >[1] 1 1
> >
> >
> >What should be the right technique for merging factors?
> >
> >
> >
> >
> >-- 
> >Svetlana Eden        Biostatistician II            School of Medicine
> >                     Department of Biostatistics   Vanderbilt University
> >
> >______________________________________________
> >R-help at stat.math.ethz.ch mailing list
> >https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> >PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> >
> With best wishes and kind regards I am
> 
> Sincerely,
> 
> Corey A. Moffet
> Rangeland Scientist
> 
> USDA-ARS
> Northwest Watershed Research Center
> 800 Park Blvd, Plaza IV, Suite 105
> Boise, ID 83712-7716
> 
> Voice: (208) 422-0718
> FAX:   (208) 334-1502
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 
> 

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list