[R] Coding problem: How can I extract substring of function callwithin the function

Greg Snow Greg.Snow at imail.org
Fri Aug 14 21:11:36 CEST 2009


Kind of to second Steve's concerns, I would suggest that you change the names of your functions slightly (put xx. in front of them or some other prefix).

I remember a friend telling of a unix administrator that aliased the rm command to actually run rm -i (rm deletes files, the -i makes it ask yes or no for each file before deleting).

Everyone on the system became used to this, but then they hired a new administrator who did not do this automatically on the new computers.  Since everyone was used to the old/non-default behavior that no longer worked, there was much sorrow as people deleted large numbers of files unintentionally.

Providing functions to make life easier is fine, but make sure that the students are used to calling them by something other than the standard names or this list will become flooded with questions on why the mean function returns NA when it used to give a warning and why are the barplots behaving differently from when they were in your class, etc.

Just some thoughts,  

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Pitt, Joel
> Sent: Thursday, August 13, 2009 4:11 PM
> To: Steve Lianoglou
> Cc: r-help at r-project.org
> Subject: Re: [R] Coding problem: How can I extract substring of
> function callwithin the function
> 
> 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. 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
> 
> 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, but my curiousity can be piqued
> when I run up against a programming problem.
> 
> Joel
> 
> 
> 
> 
> ________________________________
> 
> From: Steve Lianoglou [mailto:mailinglist.honeypot at gmail.com]
> Sent: Thu 8/13/2009 5:55 PM
> To: Pitt, Joel
> Cc: Erik Iverson; r-help at r-project.org
> Subject: Re: [R] Coding problem: How can I extract substring of
> function callwithin the function
> 
> 
> 
> Hi,
> 
> On Aug 13, 2009, at 5:30 PM, Pitt, Joel wrote:
> 
> > Thanks. It's a great solution to part of my problem. It provides the
> > functionally I want would be no harder for students to use than my
> > approach. I'm still interested in how to make what I was trying to
> > do work -- simply to add to my own R programming proficiency.
> 
> I wasn't going to really chime in, but I couldn't help it given the
> irony in your last sentence (sorry, I don't mean to sound like an ass).
> 
> I think trying to help your students with some "bumps on the road" is
> admirable, but this seems just a bit misdirected. As you say, you are
> on a quest to add to your R programming proficiency, and will apply
> this newly founded technique to actively handicap your students'
> proficiency.
> 
> I guess you're teaching some intro stat analysis class, and waving
> over the fact that functions like mean explicitly return NA in the
> presence of NA's, but this is important to know and recognize when
> analyzing any real data, because there will surely be NA's "in the
> wild." Knowing that you should consciously and deliberately deal with/
> ignore them from the start might be a good first/early lesson for
> students to digest.
> 
> Like I said, I don't mean to sound like an ass, but I think glossing
> over details of working with data should be avoided. Your other
> additions, like adding options to plotting/graphing functions, seem
> less harmful to me. But if you're trampling over some base:: function
> for something trivial like changing the value of one default parameter
> to something else, you might as well just get them to learn how to use
> the ?<function_name> asap as well.
> 
> -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
> 
> 
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list