search for: foo2arg

Displaying 5 results from an estimated 5 matches for "foo2arg".

Did you mean: foo_arg
2006 Jun 30
1
foo2Args()
...that calls other functions, and was playin with a suggestion Achim made during a conversation at useR. The idea is, instead of using list(), use a small function to construct and check arguments. My hope was to be able to do this without making it globally visible: foo <- function(x, args=foo2Args()) { foo2Args <- function(a=1, b=2){list(a,b)} # above would actual do more testing of args #now I would call foo2 with args, but to test just args } Now, > foo(1) # should I be surprized that this works [[1]] [1] 1 [[2]] [1] 2 > foo(1, args=foo2Args(a=2, b=10)) # or th...
2006 Oct 24
2
as.missing
...er instance where a feature has eluded me for many years.) Often I have a function which calls other functions, and may often use the default arguments to those functions, but needs the capability to pass along non-default choices. I usually do this with some variation on foo <- function(x, foo2Args=NULL or a list(foo2defaults), foo3Args=NULL or a list(foo3defaults)) and then have logic to check for NULL, or use the list in combination with do.call. It is also possible to do this with ..., but it always seems a bit dangerous passing all the unnamed arguments along to a...
2010 Feb 10
1
How to solve: Error in * unused argument(s) ?
Hi all, For some reason, I would like to use functions bellow (see example code bellow), but instead I get the following error message: *Error in foo2(...) : unused argument(s) (arg3 = 3)* #--------------------- # example code #--------------------- foo1 <- function(arg1,...) { print(arg1) foo2(...) foo3(...) } foo2 <- function(arg2) { print(arg2) } foo3 <- function(arg3) {
2008 Mar 25
1
Passing (Optional) Arguments
Dear List: In short, I am writing a number of functions as building blocks for other functions and have some questions about scoping and passing arguments. Suppose I have functions foo1, foo2, and foo3 such that: foo1<-function(a=1,b=TRUE,c=FALSE){#do stuff}; foo2<-function(x=1,y=FALSE,z=c(1,2,3,4)){#do stuff}; foo3<-function(lambda,...){lambda*foo1()*foo2()}; I want to be able to
2006 Jun 29
3
advice on arguments
I have a general style question about R coding. Suppose I'm writing a function (foo1) that calls other functions (foo2, foo3, ...) which have complicated argument lists (e.g. optim(), plot()), _and_ I may be calling several different functions in the body of foo1. Since foo2 and foo3 have different sets of arguments, I can't just use "..." ; I did write some code a while ago