GME

Geospatial Modelling Environment

r (Executes An R Command)

Executes R commands

Description

The r() command is different from most other GME commands in that it takes the text within the parentheses and sends it directly to R, without any interpretation of the text. For this reason you should not enclose the R command text within quotes: write the R commands here exactly as you would write them in R. This command does not recover any R objects, but you can use the r.ls() command to view a list of objects in the current R session.

This command is designed to be used in conjunction with the following commands: r.loaddata, r.writedatatofield, r.writedatatoraster. One of the most important uses of this command will be to run R scripts that you have written and saved in text files.

You must call the r() command multiple times if you have several commands to execute (rather than separate them using semi-colons within a single call to this command). Better yet, write commands to a text file, and then call that as a script.

Note that if your code requires R libraries, then you must also make sure that the libraries are installed, and that you include the R library() or require() commands to load them within your code.

Syntax

r(code);

codeR code to be evaluated (not in quotes)

Example

r(source(file="C:/scripts/ranalysis.txt"));


Messages

Please consider making a purchase to support the continued development of these tools  Read more...

Tips on how to use this interface efficiently  Read more...

Links

Open Source GIS

Copyright © 2001-2014 Hawthorne L. Beyer, Ph.D., Spatial Ecology LLC    Connect on LinkedIn