Re: [R] conversion

From: Sundar Dorai-Raj <sundar.dorai-raj_at_pdf.com>
Date: Wed 29 Jun 2005 - 07:30:11 EST

Anna Oganyan wrote:
> Dear List,
> How can I convert a list with elements being character strings, like:
> "c(1,2,3,4)", c(1,3,4,2) to a list with elements as numerical
> vectors: c(1,2,3,4), c(1,3,4,2)?
> Thanks!
> Anna
>

Try:

x <- list("c(1,2,3,4)", "c(1,3,4,2)")
lapply(x, function(x) eval(parse(text = x)))

HTH, --sundar



R-help@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 Received on Wed Jun 29 07:47:17 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:06 EST