Thank you very much for this information.
From: R. Michael Weylandt
Cc: Richard M. Heiberger ; R General Forum
Sent: Thursday, 19 January 2012, 19:17
Subject: Re: [R] Executable Expressions II
Glad you got it worked out -- I don't know C# but if
Glad you got it worked out -- I don't know C# but if it's portable-ish
to C++ you may also want to look at Dirk's RInside project:
http://dirk.eddelbuettel.com/code/rinside.html
and here in web-deployment
http://dirk.eddelbuettel.com/blog/2011/11/30/#rinside_and_wt
Michael
On Wed, Jan 18, 2012
Fabulous example, Baptiste!
Yeah, the knock is that it's just not at all clear and too often
symptomatic of someone trying to be too clever by half when there's
usually a better way. There are times when these tricks can be really
helpful for non-standard evaluation (e.g., the curve() function --
One reason might be that you can easily fool the user into running
unexpected/unreadable commands. Guess what this does:
cmd <- paste(c(letters[c(19L, 25L, 19L, 20L, 5L, 13L)], "(' ",
letters[c(19L, 21L, 4L, 15L)], " ", letters[c(4L,
5L, 19L, 20L, 18L, 15L, 25L)], " ", letters[c(1L, 12L, 12L)], "
I am not using RExcel at all.
I have now come up with a better solution that using eval. I can construct the
data structure (like c(1,2,3,4,5)) as an object in C# and pass it as the
argument to the method inside the web service that will call R. Works fine.
[[alternative HTML version del
for my info, why is this rarely a good idea? Is that the case for this
particular example , or is eval(paste()) generally rarely a good idea?
--Peter
Op 18-1-2012 22:22, R. Michael Weylandt schreef:
eval(parse(text = a))
But this is rarely a good ideaperhaps you could say a little more
If you are using rcom from Excel, then you would send R the vector of
numbers containing the values you were
interested in and you would get the mean back. I suggest you look at the
RExcel implementation and duplicate its
capabilities. The rcom documentation includes examples in other languages
t
Thank you Michael, Sarah and Robin for the answers to my original question.
Michael you asked:"But this is rarely a good ideaperhaps you could say a
little more
about your overall goal and we could direct you to a more "R"-ish solution? "
I realise eval (known as execute in one of my other
On Wed, Jan 18, 2012 at 1:18 PM, Ajay Askoolum wrote:
>
> Given
>
> a<-"c(1,2,3,4,5)"
>
> How can I evaluate the variable a to return a (numeric) vector comprising of
> 1,2,3,4,5? Thanks.
You can also use an "active binding":
> makeActiveBinding('a', function(){c(1,2,3,4,5)}, .GlobalEnv)
Hi
eval(parse(text=a)) should do the trick :)
Cheers,
Robin
2012/1/18 Ajay Askoolum
> Given
>
> a<-"c(1,2,3,4,5)"
>
> How can I evaluate the variable a to return a (numeric) vector comprising
> of 1,2,3,4,5? Thanks.
>
>[[alternative HTML version deleted]]
>
>
> __
> mytext <- "c(1,2,3,4,5)"
> a <- eval(parse(text=mytext))
> a
[1] 1 2 3 4 5
will do this, if there's no better way to accomplish your actual goal.
Sarah
On Wed, Jan 18, 2012 at 4:18 PM, Ajay Askoolum wrote:
> Given
>
> a<-"c(1,2,3,4,5)"
>
> How can I evaluate the variable a to return a (numer
eval(parse(text = a))
But this is rarely a good ideaperhaps you could say a little more
about your overall goal and we could direct you to a more "R"-ish
solution?
library(fortunes)
fortune("rethink")
Michael
On Wed, Jan 18, 2012 at 4:18 PM, Ajay Askoolum wrote:
> Given
>
> a<-"c(1,2,3,4,5
Given
a<-"c(1,2,3,4,5)"
How can I evaluate the variable a to return a (numeric) vector comprising of
1,2,3,4,5? Thanks.
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PL
13 matches
Mail list logo