s-news
[Top] [All Lists]

Re: Writing a function taking a data.frame column name as a paramete

To: <s-news@lists.biostat.wustl.edu>
Subject: Re: Writing a function taking a data.frame column name as a paramete
From: "Hunsicker, Lawrence" <lawrence-hunsicker@uiowa.edu>
Date: Sat, 27 Dec 2008 21:39:20 -0600
Thread-index: Aclondk7bVmh9qa7RW676EyCpEl78w==
Thread-topic: RE: [S] Writing a function taking a data.frame column name as a paramete

The clouds clear.  The bright sun shines in.

It turns out that my little sapply program works just fine, with one little tweak that has nothing to do with sapply itself. 

list1 <- c(5:7,11:12,15:16,20,27:29,32:33,38:42,45,50,55:64,72,77:93,99:100,107)

lapply(list1, testScrMiss)

I finally figured this out when I went to run the series of the analyses one at a time.  The first index failed even when it was run alone, but the other next several did fine.  Then I finally noticed that the first indexed column was a DateTime variable which presents itself to other functions as a list of five components.  This is what the error return was about.  When I converted the DateTime variable back into a double (which is, of course, what it is internally, anyhow) the program above worked fine. 

So it wasnt some kind of arcane scope problem.  It was a straight-forward stupid programmer problem.

Thanks once more for all the help.

Larry Hunsicker

<Prev in Thread] Current Thread [Next in Thread>
  • Re: Writing a function taking a data.frame column name as a paramete, Hunsicker, Lawrence <=