Try this. It pastes "list(" onto the front and ")" onto the end giving
"list( P = 0.0, T = 0.0, Q = 0.0 )"
and then parses and evaluates that as an R expression.
Str <- "P = 0.0, T = 0.0, Q = 0.0"
eval(parse(text = paste("list(", Str, ")")))
On 7/26/07, Manuel Morales <[EMAIL PROTECTED]> wrote:
> 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
>
> ______________________________________________
> [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.