[R] Convert string to list?
Ross Darnell
r.darnell at uq.edu.au
Fri Jul 27 02:51:55 CEST 2007
Is this what your want?
as.vector(unlist(strsplit(str,",")),mode="list")
Ross Darnell
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Manuel Morales
Sent: Friday, 27 July 2007 10:39 AM
To: r-help
Subject: [R] Convert string to list?
Let's say I have the following string:
str <- "P = 0.0, T = 0.0, Q = 0.0"
I'd like to find a function that generates the following object from
'str'.
list(P = 0.0, T = 0.0, Q = 0.0)
Thanks!
--
http://mutualism.williams.edu
______________________________________________
R-help at stat.math.ethz.ch 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.
More information about the R-help
mailing list