Илья П
Илья П

Reputation: 3

Can I execute rscript from string?

Can I execute rscript from string? Like this

> execute("d<-0") # function or command?..
> d[1]
[1] 0

Thanks

Upvotes: 0

Views: 845

Answers (1)

LAP
LAP

Reputation: 6685

You can do

> eval(parse(text = "d<-0"))
> d[1]
[1] 0

But, as always:

fortunes::fortune("answer is parse")

If the answer is parse() you should usually rethink the question. -- Thomas Lumley R-help (February 2005)

Upvotes: 5

Related Questions