Jim,
I don't know if this is the most elegant solution :
Copy the following to your clipboard (some editors will require also to take
last paragraph mark)
first
second
third
> ## now go to R and use
> dat <- read.table("clipboard") # will give data.frame
> dat
V1
1 first
2 second
3 third
> ## or if you want a character-vector
> dat <- as.character(as.matrix(read.table("clipboard")))
> dat
[1] "first" "second" "third"
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Wolfgang Raffelsberger, PhD
IGBMC,
1 rue Laurent Fries, 67404 Illkirch Strasbourg, France
Tel (+33) 388 65 3300 Fax (+33) 388 65 3276
[email protected]
________________________________________
De : [email protected] [[email protected]] de la part de
Maas James Dr (MED) [[email protected]]
Date d'envoi : lundi 14 mars 2011 10:29
À : [email protected]
Objet : [R] creating character vector
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.
Thanks
Jim
===============================
Dr. Jim Maas
University of East Anglia
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.
______________________________________________
[email protected] 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.