[R] Symbolic equations to R code?

David Winsemius dwinsemius at comcast.net
Wed Nov 19 21:12:06 CET 2014

On Nov 19, 2014, at 9:17 AM, Scott Rifkin wrote:

> I'm looking for a package that would take a mathematical function written in symbolic notation and convert it into R code.
> What I have in mind would be something like the following:
> 1) Have a GUI (e.g. something like Microsoft Word equation editor, but computer readable) to produce an equation so that it would look just like it would if you were writing it on paper
> 2) Have some way to translate the GUI into some markup language (perhaps this would be in a non-R application)

There is a web-based equation editor that emits LateX code: http://www.codecogs.com/latex/eqneditor.php

> 3) Have code that translates the markup into an R function.
> My motivation is that I teach an intro stats class that uses randomization techniques. I would like for the students to be able to make up their own statistics and then simulate null distributions or estimate bootstrap confidence intervals using them. I'd prefer to make it as easy as possible for them to enter the formula for their statistics into the computer, and I think that will be easier if it looks from their end just like it would if they were writing it on paper.  After they submit the equation, I would have an RStudio shiny applet take care of the rest.
> Any suggestions for R packages that could do this or pieces of it would be very much appreciated.

There are a couple of dropdown interfaces for R newbies with R Commander being the most famous. You appear not to have investigated what has already been attempted:

http://www.sciviews.org/_rgui/  # Admittedly a very out of date page, lots of dead links.

There are a large number of Rcmdr.plugins.

> unique(findFn("RcmdrPlugin")$Package)
found 667 matches;  retrieving 20 pages, 400 matches.
2 3 4 5 6 7 8 9 10 
11 12 13 14 15 16 17 18 19 20 

Downloaded 383 links in 50 packages.
 [1] "RcmdrPlugin.DoE"            "RcmdrPlugin.MA"            
 [3] "RcmdrPlugin.temis"          "RcmdrPlugin.HH"            
 [5] "RcmdrPlugin.FactoMineR"     "RcmdrPlugin.KMggplot2"     
 [7] "RcmdrPlugin.EACSPIR"        "RcmdrPlugin.survival"      
 [9] "RcmdrPlugin.depthTools"     "RcmdrPlugin.IPSUR"         
[11] "RcmdrPlugin.EZR"            "RcmdrPlugin.MPAStats"      
[13] "RcmdrPlugin.sampling"       "RcmdrPlugin.StatisticalURV"
[15] "RcmdrPlugin.plotByGroup"    "RcmdrPlugin.BCA"           
[17] "RcmdrPlugin.UCA"            "RcmdrPlugin.orloca"        
[19] "RcmdrPlugin.doBy"           "RcmdrPlugin.EBM"           
[21] "RcmdrPlugin.lfstat"         "RcmdrPlugin.EHESsampling"  
[23] "RcmdrPlugin.SLC"            "RcmdrPlugin.steepness"     
[25] "RcmdrPlugin.TextMining"     "RcmdrPlugin.doex"          
[27] "RcmdrPlugin.qual"           "RcmdrPlugin.ROC"           
[29] "RcmdrPlugin.SensoMineR"     "RcmdrPlugin.seeg"          
[31] "RcmdrPlugin.qcc"            "RcmdrPlugin.SM"            
[33] "RcmdrPlugin.TeachingDemos"  "RcmdrPlugin.EcoVirtual"    
[35] "RcmdrPlugin.sos"            "RcmdrPlugin.coin"          
[37] "RcmdrPlugin.epack"          "RcmdrPlugin.SCDA"          
[39] "RcmdrPlugin.SurvivalT"      "RcmdrPlugin.NMBU"          
[41] "RcmdrPlugin.pointG"         "RcmdrPlugin.MAc"           
[43] "RcmdrPlugin.MAd"            "RcmdrPlugin.mosaic"        
[45] "RcmdrPlugin.Export"         "MAc"                       
[47] "RcmdrPlugin.PT"             "compute.es"       

> Thanks,
> Scott
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA

More information about the R-help mailing list