These are helper functions that deal with pathing to Macaulay2 and asking if it is present. When the Macaulay2 package is loaded it attempts to find the Macaulay2 executable by looking for an environment variable indicating where it is, i.e. its path as specified in your .Renviron file.
1 2 3 4 5 6 7 8 9 10 11
A character string, the path to M2
For easiest use, you'll want to specify the path the Macaulay2 executable in your ~/.Renviron file. It should look something like
You can set this permanently with
edit_r_environ(). Note that absolute
paths should be specified, not relative paths, e.g. don't use ~/path/to/exe.
You can change this for the current session using
accepts a character string or, if missing, uses
file.choose() to let you
interactively; you just select an arbitrary executable.
On Windows, m2r just defaults to the cloud implementation. Local M2 instances are not currently supported on Windows.
An invisible character string, the path found. More importantly, the function has the side effect of setting the global m2r option "m2_path"
David Kahle firstname.lastname@example.org
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
## Not run: requires Macaulay2 getOption("m2r") get_m2_path() set_m2_path() ## each of these functions can be used statically as well (m2_path <- get_m2_path()) set_m2_path("/path/to/m2/directory") get_m2_path() set_m2_path(m2_path) # undoes example # if you'd like to use the cloud, after you library(m2r) # and before you use m2() type set_m2_path(NULL) # alternatively, if you have already been using m2, do: stop_m2() set_m2_path(NULL) m2("1+1") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.