[R] Coding problem: How can I extract substring of function callwithin the function
Steve Lianoglou
mailinglist.honeypot at gmail.com
Fri Aug 14 02:36:33 CEST 2009
Hi Joel,
On Aug 13, 2009, at 6:10 PM, Pitt, Joel wrote:
> Your objections are quite cogent, but I believe they are
> misdirected. I'm not at all interested in having my students ignore
> the existence of NA's and that's precisely why I'm not using the
> Default package as someone else suggested. But the mere existence of
> missing values in a data set doesn't make computation of the mean
> entirely useless -- why else would the na.rm option be available.
I agree: it's certainly not useless to calc the mean of a series of
numbers while ignoring NA's.
> If a student using my version of mean uses it to find the mean of a
> variable that has missing values, the function first prints a
> warning message and only then returns a value. Here's an example
>
> > length(x)
> [1] 101
> > mean(x)
> Warning: x has 3 missing values.
> [1] 51.69388
Looks nice.
> My only goal in this project has been to provide them with a
> somewhat friendlyR version of R. It was not conceived as part of a
> quest to improve my programming proficiency
I didn't think you were pursuing this to improve your programming
proficiency from the outset, I just wanted to point out that you found
a situation which you wanted to work around for (i) your precise use
case. But it was because you were trying to solve (i) that you
stumbled on (ii) and wanted to just know how one might do this for
curiosity's sake and increase your proficiency (perhaps for some other
use case in the future).
It was simply for reason (ii) that prompted me to say something only
because you might not have seen your approach as potentially
handicapping your students' (maybe subconcious(?)) pursuit of
proficiency. I just wanted to point out that this is what you *might*
be doing in the short term. Then again, it might not be.
Everyone has their own style of teaching, and it's your prerogative to
do it as you see fit. I wouldn't presume to know which way is best, so
good luck with the upcoming semester :-)
-steve
--
Steve Lianoglou
Graduate Student: Computational Systems Biology
| Memorial Sloan-Kettering Cancer Center
| Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact
More information about the R-help
mailing list