Thread overview
D For Data Science: Calling R from D
Jan 27, 2020
Mike Parker
Jan 27, 2020
Adam D. Ruppe
Jan 27, 2020
Mike Parker
Jan 27, 2020
bachmeier
Jan 27, 2020
jmh530
Jan 27, 2020
bachmeier
January 27, 2020
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/
January 27, 2020
On Monday, 27 January 2020 at 14:16:47 UTC, Mike Parker wrote:
> https://dlang.org/blog/2020/01/27/d-for-data-science-calling-r-from-d/

"D [...] interoperability with C (in many cases as simple as adding an #include directive to import a C header file), "

like it is simple... but it isn't a #include directive unless you use third party things (that have their own issues).

Minor thing but can be misleading to newcomers.
January 27, 2020
On Monday, 27 January 2020 at 14:20:20 UTC, Adam D. Ruppe wrote:
> On Monday, 27 January 2020 at 14:16:47 UTC, Mike Parker wrote:
>> https://dlang.org/blog/2020/01/27/d-for-data-science-calling-r-from-d/
>
> "D [...] interoperability with C (in many cases as simple as adding an #include directive to import a C header file), "
>
> like it is simple... but it isn't a #include directive unless you use third party things (that have their own issues).
>
> Minor thing but can be misleading to newcomers.

Good point. I've added a mention of dpp and a link to the Project Highlight on the blog.
January 27, 2020
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.
January 27, 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.
January 27, 2020
On Monday, 27 January 2020 at 14:20:20 UTC, Adam D. Ruppe wrote:
> On Monday, 27 January 2020 at 14:16:47 UTC, Mike Parker wrote:
>> https://dlang.org/blog/2020/01/27/d-for-data-science-calling-r-from-d/
>
> "D [...] interoperability with C (in many cases as simple as adding an #include directive to import a C header file), "
>
> like it is simple... but it isn't a #include directive unless you use third party things (that have their own issues).
>
> Minor thing but can be misleading to newcomers.

Good catch. I intended to link to both dpp and dstep but I forgot to do it.