Displaying 3 results from an estimated 3 matches for "makefoo".
Did you mean:
makeboot
2012 Jan 31
1
Using match.arg() with list of functions?
I have a function of two arguments, (m, n) that returns a list with the
same structure as the function makefoo below.
When m=1, it returns a list of vectors, each of length n.
When m>1, it returns a list of square matrices, each of size m x m.
makefoo <- function(m, n) {
if (m==1) {
A <- sample(1:100, n)
B <- sample(1:100, n)
C <- sample(1:100, n)
}...
2013 Jan 28
1
parse/eval and character encoded expressions: How to deal with non-encoding strings?
Hi,
I am intending to save a path-describing character object in a slot of a
class I'm working on. In order to have the option to use "system.file" etc
in such string-saved path definitions, I wrote this
ExpressionEvaluator <- function(x){
x <- tryCatch(
expr=base::parse(text=x),
error = function(e){return(as.expression(x))},
finally=TRUE)
return(x)
}
This
2006 Apr 13
4
Creating an environment for a function.
I am trying to build a function in a context where the environment
concept would appear to be useful. But I'm a bit foggy about this
concept and would appreciate some pointers and advice.
Basically the function I'm building, say foo(x,t), is a function of
two variables). Depending on the value of t, foo will return one of
the values f1(x), f2(x), ..., fk(x), where each of f1, ..., fk is