MM2R: Convert Mathematica to R

Description Usage Arguments Details Value Examples

View source: R/game_helpers.R

Description

Convert Mathematica to R

Usage

1
MM2R(path, ...)

Arguments

path

Path to file to convert

...

Arguments to change, listed in vector format as c(x1,x2)

Details

For each argument in ..., replaces x1 with x2 using gsub. This is done sequentially, following the order of parameters in .... For example, c(" ","*"),c("x1","x\[1\]") changes " " to "*" and then "x1" to "x[1]". Special characters must be escaped.

Value

Returns the corrected equations using

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
eqns <- MM2R(path="mathematica/unconfined_eqns.txt", g1=c(" ","*"), g1=c("Sqrt","sqrt"))

sink("./mathematica/unconfined_nl_eqns_R.txt")
eqns <- MM2R(path="mathematica/unconfined_nl_eqns.txt",g1=c(" ","*"),g2=c("Sqrt","sqrt"),
             g3=c("Log","log"),g4=c("\\[","\\("),g5=c("\\]","\\)"),g6=c("x1","x\\[1\\]"),
             g6=c("x2","x\\[2\\]"))
sink()

## End(Not run)

gopalpenny/genevoisgame documentation built on Sept. 9, 2020, 1:46 a.m.