Displaying 1 result from an estimated 1 matches for "calcsomethingfrom".
2006 Nov 19
2
good practice for values not provided
...nning...
I encountered a minor question of style. Consider a function
f <- function(a,b,x=NULL) {
## ...
}
if !is.null(x), f will use x to calculate the result, but if
is.null(x), it will do something else not involving x at all (using
any x would be meaningless here, so I can't use
x=calcsomethingfrom(a,b)).
What's the accepted way of indicating this in R with a default for x?
x=FALSE? x=NA? x=NULL?
Thanks,
Tamas