D For Data Science: Calling R from D

bachmeier no at spam.net
Mon Jan 27 21:08:21 UTC 2020


On Monday, 27 January 2020 at 14:55:37 UTC, jmh530 wrote:
> On Monday, 27 January 2020 at 14:16:47 UTC, Mike Parker wrote:
>> You've seen Lance Bachmeier posting in the forums under the 
>> bachmeier handle. He's put together a post for the D Blog 
>> showing how to integrate R into a D program.
>>
>> The Blog:
>> https://dlang.org/blog/2020/01/27/d-for-data-science-calling-r-from-d/
>>
>> Reddit:
>> https://www.reddit.com/r/programming/comments/euobu1/d_for_data_science_calling_r_from_d/
>>
>> It's also on Hacker News. If it isn't on the front page, just 
>> search for "D for Data Science". Please don't post a direct 
>> link if you find it on there, not until after it's been on 
>> there a few days.
>>
>> https://news.ycombinator.com/
>
> Great piece. Glad to see it.
>
> One point that is confusing is below:
>
> "There are two ways to execute R code from a D program. evalR 
> executes a string in R and prints the output to the screen, 
> while evalRQ does the same thing but suppresses the output. 
> evalRQ also accepts an array of strings that are executed 
> sequentially."
>
> So evalR normally prints the output to the screen, but evalRQ 
> does not unless you specify it with a print statement. However, 
> in Example 4 later have an array of strings with a print 
> statement at the end but it says that it won't print from it. 
> So does Example 4 print or not? Maybe distinguish between 
> suppress in D and print with R a little more clearly?
>
> In addition, the embedr documentation could probably be more 
> clear on the difference between evalR and evalRQ using some of 
> this text.

Thanks for catching that. I must have messed that up during 
editing. This is incorrect: "evalR executes a string in R and 
prints the output to the screen". evalR executes a string in R 
and then returns the R output to D as an Robj struct. The comment 
on Example 4 is also wrong. I'll have to think about the best way 
to word things and ask Mike to make the change.


More information about the Digitalmars-d-announce mailing list