# [R] Symbolic equations to R code?

Boris Steipe boris.steipe at utoronto.ca
Thu Nov 20 20:57:15 CET 2014

```I usually find my students appreciate it when I teach them something that has utility in multiple contexts. Teaching them how to express an idea in R code is valuable. And as far as structuring thought and expressing ideas go, it's quite equivalent to symbolic equations. Both are just notation.

\$ 0.02
Cheers,
B.

On Nov 20, 2014, at 2:35 PM, Scott Rifkin <sarifkin at ucsd.edu> wrote:

> Ista,
>
> On the one hand I'd like it to be as flexible as possible so the students could really come up with whatever they like.  On the other hand, restricting their choices probably would make it easier to do the backend.  The goal would be to get them to realize that the apparatus of hypothesis testing (when done via simulation/randomization techniques) doesn't depend on what the statistic is. The flow of steps is the same whether the statistic is a mean, variance, or their own kooky thing. Obviously this isn't the end of the story - what the statistic is actually describing is also a crucial component to interpreting the results of a hypothesis test, but I think it teaches an important pedagogical point about where statistics come from and that if they find themselves in a situation in the future where they need to make up their own, then that is perfectly okay.
>
> So they could make up ones like:  arctan( (max({x})^2)/ (min({x})^2) )-3), max({x})-min({x}), sum from i to n of (x_i - 25th%ile({x}) )^3)  [that might be tricky to write in a standard equation editor]
> none of these is hard to write in R, but translating from an equation editor might be.
>
> Perhaps the best solution is (as Alan suggests below) to write a Shiny function builder myself so that I can control the whole process and make sure that they can't enter anything that would break the backend.  Or to have them learn the rudiments of writing equations in R so that it bypasses the whole process.
>
> Thanks,
> Scott
>
>
>
> On 11/19/14 1:52 PM, Ista Zahn wrote:
>> Hi Scott,
>>
>> Can you give a couple of examples of the equations you have in mind
>> along with how those should be translated to R?
>>
>> Thanks,
>> Ista
>>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help