[R-SIG-Mac] Executing iOS system code within R

Marc Schwartz marc_schwartz at me.com
Tue Oct 10 20:15:18 CEST 2017


I was kind of wondering that myself...given the frequent prior discussions here regarding running R on iOS... :-)

My recommendation would be to use R's built in file/folder/path related functionality, such as:

  ?getwd (which includes ?setwd)

  ?list.files

  ?file.info

  ?files

and other related functions listed under the "See Also" sections of those help pages.

You can use getwd() to store the current working directory in a vector, execute whatever system() level commands you need to, then restore the current working directory to the original:

  CurrDir <- getwd()

  system(YourSystemLevelCallsHere)

  setwd(CurrDir)



Regards,

Marc Schwartz



> On Oct 10, 2017, at 2:05 PM, Christofer Bogaso <bogaso.christofer at gmail.com> wrote:
> 
> Yes macOS - High Sierra
> 
> On Tue, Oct 10, 2017 at 11:33 PM, elijah wright <elw at stderr.org> wrote:
>> Did you mean macOS?  I am not aware of anything that can run both R
>> and iOS code - if there's some fancy thing out there that can, i would
>> like to know about that.  ;-)
>> 
>> --e
>> 
>> 
>> On Tue, Oct 10, 2017 at 12:58 PM, Christofer Bogaso
>> <bogaso.christofer at gmail.com> wrote:
>>> Hi again,
>>> 
>>> I need to execute few line of system codes for iOS from R. Basically
>>> that execution involves (as an example) :
>>> 
>>> 1. Change the Working directory first
>>> 2. Execute some task (e.g.deleting a file)
>>> 3. Then go back to original folder/directory
>>> 
>>> I am aware of system() function which can be used here. However it
>>> looks that system() function executes iOS code one-by-one i.e. after I
>>> execute system('cd .....') for #1 above, that changed directory is not
>>> passed for #2 and so on.
>>> 
>>> Is there any way where I can run a chain on iOS code as-a-whole using R.
>>> 
>>> Your help will be highly appreciated.
>>> 
>>> Thanks for your time.
>>> 
>>> _______________________________________________
>>> R-SIG-Mac mailing list
>>> R-SIG-Mac at r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> 
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac



More information about the R-SIG-Mac mailing list