On 03/14/2011 08:29 PM, Maas James Dr (MED) wrote:
Is there a way to convince R to create a character vector without using the
quotes?
This works
ex1<- c("first","second")
but when I try this it doesn't
ext<- as.character(c(first,second))
it complains. I have many variables to put into character vectors so dispensing
with the quotes would be useful.
Hi Jim,
If you are reading values in from a file, you can get character vectors
like this:
<contents of file "charvec.txt">
Monday Tuesday Wednesday Thursday Friday Saturday
charvec<-unlist(read.table("charvec.txt",stringsAsFactors=FALSE))
is.character(charvec)
Jim
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.