GME

Geospatial Modelling Environment

r.eval

This function evaluates an expression in R, and retrieves the result

Description

This function is designed to be embedded within command text. It provides a mechanism for running R code to obtain strings, numbers or arrays that are used as parameters for GME command arguments.

Important note. The r.eval syntax is different than all other GME commands because you must not enclose the R code in quotes. All other GME commands and functions require that you enclose all text in quotes, but the code contained within the r.eval(...) function is sent directly to R. The reason for this is that you may need to use quotes in your R code, which is perfectly acceptable.

Important note. R commands must be separated by semi-colons.

If the R code is single line and simple, then GME will automatically retrieve the resulting value. However, if your R code is complex, and/or multiline, then you must explicitly set a variable called 'gme' within that R code, which GME will then retrieve. If your code is complex, I recommend you save it as an R script file, and then use the r.eval function to call that 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() command to load them within your code.

Syntax

r.eval(code)

codeR code to be evaluated

Example

r.eval(seq(0, 1, 0.02))

r.eval(exp(-0.01*200))

r.eval(a <- rnorm(10, 100, 12.234); gme <- log(a))


Messages

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

An apology for failing to respond to correspondence in recent months  Read more...

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

Sign up for the newsletter if you wish to receive notification of updates, new functionality, bug fixes, and other related news

Links

Open Source GIS

Copyright © 2001-2010 Hawthorne L. Beyer, Spatial Ecology LLC