[R] store levels in a string

Marc Schwartz (via MN) mschwartz at mn.rr.com
Tue Apr 18 18:29:47 CEST 2006


On Tue, 2006-04-18 at 18:07 +0200, Daniele Medri wrote:
> Il giorno mar, 18/04/2006 alle 11.00 -0500, Marc Schwartz (via MN):
> > > mylevels<- ...a string with all the levels(af)
> > > mylevels <- levels(af)
> > 
> > > mylevels
> > [1] "a" "b"
> 
> I don't need to store these two levels, but a string with the values
> "ab".
> 
> Thanks
> 
> Cheers
> --
> DM

> paste(levels(af), collapse = "")
[1] "ab"

See ?paste.

HTH,

Marc Schwartz




More information about the R-help mailing list