[R] c/cbind/rbind of factor variables
Chong Gu
chong at stat.purdue.edu
Sat Feb 1 22:01:05 CET 2003
Thanks for all the replies.
Actually, I ran into this only because I was using the wrong approach
to solve the real problem I had. Through private email exchanges
Professor Ripley tipped me into the right direction, so case is solved
but not through this.
Thanks to all for your attentions.
Chong Gu
> Chong Gu <chong at stat.purdue.edu> writes:
>
> > I guess this is a feature
> >
> > > c(as.factor(2),as.factor(3))
> > [1] 1 1
> >
> > But is there a way to turn off the feature and return the following?
> >
> > [1] 2 3
> >
> > Thanks for any pointer.
>
> How about
>
> cc <- function(...) do.call("c", lapply(list(...),as.character))
> cc(as.factor(2),as.factor(3))
>
> ?
>
> (or as.integer(do.call.....) if you really want integers back)
> --
> O__ ---- Peter Dalgaard Blegdamsvej 3
> c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
> (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
> ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list