Hello, I have a simulation model (command line tool) written in Objective C/ Cocoa. I would like to know if it is possible to call it from R and get the results into R as well. The documentation explains how to do it with C or Fortran, but I have not found anything with Objective C/ Cocoa. Has anyone tried do this or do you know an example explaining how? Thanks Guillaume
Calling Objective C/Cocoa code from R
7 messages · Guillaume Chapron, Brian Ripley, Simon Urbanek +2 more
Hi, I am running CarbonEmacs and calling R from ESS. When I graph data the default device in ESS is X11() and I'd prefer it to call quartz() instead. Is there a way that I can do this by default without having to specify quartz() prior to running a graph? Cheers, Chris ----------------- Christopher David Desjardins Ph.D. Student Quantitative Methods in Education Department of Educational Psychology University of Minnesota http://blog.lib.umn.edu/desja004/educationalpsychology/
See ?options, look at 'device'. This is getting to be an FAQ ....
On Thu, 12 Mar 2009, Christopher David Desjardins wrote:
Hi, I am running CarbonEmacs and calling R from ESS. When I graph data the default device in ESS is X11() and I'd prefer it to call quartz() instead. Is there a way that I can do this by default without having to specify quartz() prior to running a graph? Cheers, Chris ----------------- Christopher David Desjardins Ph.D. Student Quantitative Methods in Education Department of Educational Psychology University of Minnesota http://blog.lib.umn.edu/desja004/educationalpsychology/
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Guillaume,
On Mar 12, 2009, at 14:35 , Guillaume Chapron wrote:
I have a simulation model (command line tool) written in Objective C/ Cocoa. I would like to know if it is possible to call it from R and get the results into R as well. The documentation explains how to do it with C or Fortran, but I have not found anything with Objective C/ Cocoa. Has anyone tried do this or do you know an example explaining how?
ObjectiveC uses the same ABI as C (it's in fact just a very thin layer above C), so you can safely use R's C API. In addition, if you want to instantiate ObjC objects and pass messages (without going through function calls), you can use one of the ObjC packages around: Cocoa (http://www.rforge.net/Cocoa/ ) or RObjectiveC (http://www.omegahat.org/RObjectiveC/ ). All of the above assumes that you want to use that tool as a library (R supports ObjC in packages out of the box). If you want to just invoke it on the command line, you can use the regular system() interface. Cheers, Simon
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20090312/cf697d22/attachment.pl>
The easiest way for you, is to put your Sys.setenv command inside a file called .Rprofile, locate in the root of your home directory, ie. ~/.Rprofile Commands in this file gets run when you start R. Kasper
On Mar 12, 2009, at 13:29 , Christopher David Desjardins wrote:
Thanks. I've seen this posted on the internet and here as well but I'm not sure I understand the syntax for setting it permanently. When I run Sys.setnenv(R_INTERACTIVE_DEVICE="quartz") It works fine until I close R and then I when I open R again via ESS X11 is called. I am sorry if this seems like a redundant question. I've really googled this and found this https://stat.ethz.ch/pipermail/r-sig-mac/2008-October/005402.html and similar posts but I'm not sure how it helps. I've read the device section in options() but it still remains unclear to me. Thanks, Chris On Mar 12, 2009, at 2:26 PM, Prof Brian Ripley wrote:
See ?options, look at 'device'. This is getting to be an FAQ .... On Thu, 12 Mar 2009, Christopher David Desjardins wrote:
Hi, I am running CarbonEmacs and calling R from ESS. When I graph data the default device in ESS is X11() and I'd prefer it to call quartz() instead. Is there a way that I can do this by default without having to specify quartz() prior to running a graph? Cheers, Chris ----------------- Christopher David Desjardins Ph.D. Student Quantitative Methods in Education Department of Educational Psychology University of Minnesota http://blog.lib.umn.edu/desja004/educationalpsychology/
-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
----------------- Christopher David Desjardins Ph.D. Student Quantitative Methods in Education Department of Educational Psychology University of Minnesota http://blog.lib.umn.edu/desja004/educationalpsychology/ [[alternative HTML version deleted]]
_______________________________________________ R-SIG-Mac mailing list R-SIG-Mac at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-mac
Thanks Kasper and Prof. Brian. Using Sys.setenv in ~/.Rprofile fixed it. Chris
On Mar 12, 2009, at 8:51 PM, Kasper Daniel Hansen wrote:
The easiest way for you, is to put your Sys.setenv command inside a file called .Rprofile, locate in the root of your home directory, ie. ~/.Rprofile Commands in this file gets run when you start R. Kasper On Mar 12, 2009, at 13:29 , Christopher David Desjardins wrote:
Thanks. I've seen this posted on the internet and here as well but I'm not sure I understand the syntax for setting it permanently. When I run Sys.setnenv(R_INTERACTIVE_DEVICE="quartz") It works fine until I close R and then I when I open R again via ESS X11 is called. I am sorry if this seems like a redundant question. I've really googled this and found this https://stat.ethz.ch/pipermail/r-sig-mac/2008-October/005402.html and similar posts but I'm not sure how it helps. I've read the device section in options() but it still remains unclear to me. Thanks, Chris On Mar 12, 2009, at 2:26 PM, Prof Brian Ripley wrote:
See ?options, look at 'device'. This is getting to be an FAQ .... On Thu, 12 Mar 2009, Christopher David Desjardins wrote:
Hi, I am running CarbonEmacs and calling R from ESS. When I graph data the default device in ESS is X11() and I'd prefer it to call quartz() instead. Is there a way that I can do this by default without having to specify quartz() prior to running a graph? Cheers, Chris ----------------- Christopher David Desjardins Ph.D. Student Quantitative Methods in Education Department of Educational Psychology University of Minnesota http://blog.lib.umn.edu/desja004/educationalpsychology/
-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
----------------- Christopher David Desjardins Ph.D. Student Quantitative Methods in Education Department of Educational Psychology University of Minnesota http://blog.lib.umn.edu/desja004/educationalpsychology/ [[alternative HTML version deleted]]
_______________________________________________ R-SIG-Mac mailing list R-SIG-Mac at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-mac
----------------- Christopher David Desjardins Ph.D. Student Quantitative Methods in Education Department of Educational Psychology University of Minnesota http://blog.lib.umn.edu/desja004/educationalpsychology/