Live data from Hacker News

D for Data Science: Calling R from D

dlang.org

1–10 of 23 posts

Re: D for Data Science: Calling R from D

#3
post #2

Does anyone actually need to do this? Doesn't interoping in the other direction (calling D from R) at least make a bit more sense?

R has some really excellent builtin numerical and statistical routines that are exposed via a C API: https://colinfay.me/r-installation-administration/the-standa...

Re: D for Data Science: Calling R from D

#5
post #2

Does anyone actually need to do this? Doesn't interoping in the other direction (calling D from R) at least make a bit more sense?

My guess would be leveraging all the libraries and packages in R, without having to rewrite them in D.

Here's what I'm not getting:

Most the tasks that require heavy computation in R are done through C/C++/Fortran APIs - why can't D interface with them without the intermediate R layer?

The ones that are R-native - visualisation/dataframes - are best done through R itself - what's the use case for doing that through D at all?

Re: D for Data Science: Calling R from D

#6
post #5

Earlier quoted context omitted.

My guess would be leveraging all the libraries and packages in R, without having to rewrite them in D.

Here's what I'm not getting: Most the tasks that require heavy computation in R are done through C/C++/Fortran APIs - why can't D interface with them without the intermediate R layer? The ones that are R-native - visualisation/dataframes - are best done through R itself - what's the use case for doing that through D at all?

The matrix algebra and array manipulation is written in C++. The statistical analysis is done in R, potentially using multiple different matrix algebra routines. For example.

I have no idea why you would not use R (or python) «at the top», though. R might not have great libraries for network protocols (REST, etc), as it’s not a general language, but more stats oriented.

Re: D for Data Science: Calling R from D

#7
post #6
post #5

Earlier quoted context omitted.

Here's what I'm not getting: Most the tasks that require heavy computation in R are done through C/C++/Fortran APIs - why can't D interface with them without the intermediate R layer? The ones that are R-native - visualisation/dataframes - are best done through R itself - what's the use case for doing that through D at all?

The matrix algebra and array manipulation is written in C++. The statistical analysis is done in R, potentially using multiple different matrix algebra routines. For example. I have no idea why you would not use R (or python) «at the top», though. R might not have great libraries for network protocols (REST, etc), as it’s not a general language, but more stats oriented.

> R might not have great libraries for network protocols (REST, etc), as it’s not a general language

No idea how it compares to D, but REST in R is pretty straightforward through the httr library. And in general the "general purpose" aspect of the language is pretty good.

Re: D for Data Science: Calling R from D

#8
post #2

Does anyone actually need to do this? Doesn't interoping in the other direction (calling D from R) at least make a bit more sense?

One use case I have is embedding statistical calculations in larger applications. Calling R from the language the application is written in is a lot better than rewriting the statistical calculation in that language, especially when it is a complex model.

Re: D for Data Science: Calling R from D

#10
post #5

Earlier quoted context omitted.

My guess would be leveraging all the libraries and packages in R, without having to rewrite them in D.

Here's what I'm not getting: Most the tasks that require heavy computation in R are done through C/C++/Fortran APIs - why can't D interface with them without the intermediate R layer? The ones that are R-native - visualisation/dataframes - are best done through R itself - what's the use case for doing that through D at all?

From the article:

>This article shows how to embed an R interpreter inside a D program, pass data between the two languages, execute arbitrary R code from within a D program, and call the R interface to C, C++, and Fortran libraries from D.

Post reply on HN