[R] Run a Python code from R

Nelly Reduan nell.redu at hotmail.fr
Wed Nov 16 23:53:50 CET 2016


Hello,


How can I run this Python code from R ?


>>> import nlmpy
>>> nlm = nlmpy.mpd(nRow=50, nCol=50, h=0.75)
>>> nlmpy.exportASCIIGrid("raster.asc", nlm)


Nlmpy is a Python package to build neutral landscape models

https://pypi.python.org/pypi/nlmpy . The example comes from this website. I tried to use the function system2 but I don't know how to use it.


path_script_python <- "C:/Users/Anaconda2/Lib/site-packages/nlmpy/nlmpy.py"

test <- system2("python", args = c(path_script_python, as.character(nRow), as.character(nCol), as.character(h)))

Thanks a lot for your help.
Nell


nlmpy 0.1.3 : Python Package Index<https://pypi.python.org/pypi/nlmpy>
pypi.python.org
NLMpy. NLMpy is a Python package for the creation of neutral landscape models that are widely used in the modelling of ecological patterns and processes across ...



	[[alternative HTML version deleted]]



More information about the R-help mailing list