search for: myif

Displaying 3 results from an estimated 3 matches for "myif".

Did you mean: mydf
2019 May 26
2
"if" function in pure R?
Hi all, Could anyone refer to me to a good source to learn how to program a simple control-flow construct* in R, or provide me with a simple example? Control-flow constructs are programmed as primitives, but I would like to be able to do that (if possible) in pure R. The general context is that those functions are a mystery to me. The motivating example is that I would like to create a function
2019 May 27
1
"if" function in pure R?
...n to get its function arguments in an > expression format and proceed to do what you want. Here is an example to > show the idea. > > *Code:* > > `%myOperator%` <- function(x, y) { > x = substitute(x) > y = substitute(y) > return(list(x, y)) > } > > > myIf(i == 1, arg1) %myOperator% { > doSomeThing > } > > > *Results:* > > [[1]] > myIf(i == 1, arg1) > > [[2]] > { > doSomeThing > } > > I hope that helps. > > Best, > Jiefei > > On Sun, May 26, 2019 at 4:45 AM Alexandre Courtiol < >...
2019 May 27
0
"if" function in pure R?
...rand respectively. You then can call the `substitute` function to get its function arguments in an expression format and proceed to do what you want. Here is an example to show the idea. *Code:* `%myOperator%` <- function(x, y) { x = substitute(x) y = substitute(y) return(list(x, y)) } myIf(i == 1, arg1) %myOperator% { doSomeThing } *Results:* [[1]] myIf(i == 1, arg1) [[2]] { doSomeThing } I hope that helps. Best, Jiefei On Sun, May 26, 2019 at 4:45 AM Alexandre Courtiol < alexandre.courtiol at gmail.com> wrote: > Hi all, > > Could anyone refer to me to a...