Paul.Rustomji at csiro.au
2012-May-02 04:47 UTC
[R] returning value from source() in R .Net
Hello I would like to source an R script from within a C# .Net application equivalent to: source("my_r_code.r") I can get this to run but am not sure how to retrieve R objects defined with script my_r_code.r at runtime. For example, if "my_r_code.r" contains #-- contents of my_r_code.r--------------------- x <- 1:10 xmean <- mean(x) #------------------------------------------------------ My question is how to return the value of xmean to the .Net application? Paul [[alternative HTML version deleted]]
I am mystified as to why you think you can source a snippet of one interpreted language into a different compiled language. Fortunately this is not the correct forum for your question, so I can punt. Google suggests that you look at rdotnet.codeplex.com, and perhaps read their documentation, and if that doesn't help then post your question on their discussion forum. --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. Paul.Rustomji at csiro.au wrote:>Hello >I would like to source an R script from within a C# .Net application >equivalent to: > >source("my_r_code.r") > >I can get this to run but am not sure how to retrieve R objects defined >with script my_r_code.r at runtime. > >For example, if "my_r_code.r" contains > >#-- contents of my_r_code.r--------------------- >x <- 1:10 >xmean <- mean(x) >#------------------------------------------------------ > >My question is how to return the value of xmean to the .Net >application? > >Paul > > > > > > [[alternative HTML version deleted]] > >______________________________________________ >R-help at r-project.org mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.