[R] initialize a factor vector

Johannes Huesing johannes at huesing.name
Sun Jul 13 21:44:40 CEST 2008

Gavin Simpson <gavin.simpson at ucl.ac.uk> [Sun, Jul 13, 2008 at 08:18:37PM CEST]:
> On Sun, 2008-07-13 at 18:47 +0200, Johannes Huesing wrote:
> > as.factor(c("eins", "zwei", "drei"))[FALSE] 
> > does the job but looks a bit weird.
> > 
> > factor(levels = c("one","two","three"))
> factor(0)
> Levels: one two three

Ah, ok, I was unaware of factor(), only knew as.factor(). 

Many thanks

Johannes Hüsing               There is something fascinating about science. 
                              One gets such wholesale returns of conjecture 
mailto:johannes at huesing.name  from such a trifling investment of fact.                
http://derwisch.wikidot.com         (Mark Twain, "Life on the Mississippi")

More information about the R-help mailing list