However, you could redefine the functions "mean" and "median" so the default was "na.rm=TRUE". That's easy to do with median: Type "median" at a command prompt, copy the result to a script file, modify it, and source it. You could also build your own package and attach it in a leading position in your search path so your version of median, etc., got used instead of the system version. Doing this with "mean" is harder, because is a generic function, which means that you would need to know how to modify generic functions.
I would not recommend this. To take an extreme analogy, I'm reminded of the old joke about a state senator in the sovereign state of __________ (you pick it), who declared that 3.14, etc., was too hard for school children to learn, and it school would be easier if pi were 3. He therefore introduced legislation to make pi = 3 (in his state, of course). You can do that in R, just by typing "pi <- 3" at any command prompt. However, it might have unintended consequences.
hope this helps. spencer graves
Uwe Ligges wrote:
[EMAIL PROTECTED] wrote:
dear R wizzards: two options() related questions.
[a] options(na.action): many of my variables have missing variables, so I would like to set a default to ignore, especially in univariate functions like mean() and median() . alas, without na.rm=T in the functions themselves, I always get an NA. my code is full of na.rm=T is there a magic invokation of options with na.action that is honored by these functions?
No.
[b] options(?): how do I get R to not prompt me for saving the workspace upon exit, but to instead automatically save the command history .Rhistory but not the data .RData ?
you can define a function like:
Q <- function (save = "no", status = 0, runLast = TRUE){ savehistory() .Internal(quit(save, status, runLast)) }
and call Q(), if you want to exit.
Uwe Ligges
help appreciated.
sincerely,
/iaw --- ivo welch professor of finance and economics brown / nber / yale
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
