[R] character vectors in data.frames

Lorenz Gygax lgygax at access.unizh.ch
Fri Jan 8 13:58:03 CET 1999


Dear all,

well, today I just seem to run into these problems ... (I am still working
on R 0.63.1 on a SuSE 5.2). I would like to have a data.frame that also
contains character (and NOT factor) vectors. Two things that I tried (the
second worked in R 0.62.2):

> test.df <- data.frame (X= character (4))
> test.df$X [1] <- "a"
Warning: invalid factor level, NAs generated

or:

> X <- c ("a", "b", "c")
> is.character (X)
[1] TRUE
> test.df <- data.frame (X)
> is.character (test.df$X)
[1] FALSE

Any suggestions how to achieve this? Many thanks!

--			~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lorenz Gygax		 LGygax at amath.unizh.ch;       room: 36-L-40
			 Department of Applied Mathematics
			 University of Zuerich-Irchel
			 Winterthurerstr. 190; CH-8057 Zurich
			 voice: 41-1-635-58-52  fax: 41-1-635-57-05
			~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list