s-news
[Top] [All Lists]

tapply question

To: <s-news@lists.biostat.wustl.edu>
Subject: tapply question
From: "Michael Slattery" <Michael.Slattery@epa.state.oh.us>
Date: Thu, 6 Mar 2008 09:16:08 -0500
Hello All,
I have a tapply problem, which I thought was an easy one, but the solution has nonetheless eluded me (more coffee?).
 
My dataframe structure is this:
 
index          R1                         R2......................R40        
 
A                NA                         345.6
C               non-detect               non-detect
B                1.03                       NA
B                1.55                       NA
A               NA                          234.5
C               non-detect               NA
.
.
.
 
What I need are simultaneous counts of 1) NA's and 2) non-detect's for each column Rx, for each index (n=3), across some 40 columns and some 150K records. My idea is to cbind the results of this query into a dataframe for analysis. I just can't seem to get the correct syntax.
 
I should say that I have tried flipping between a datatype of factor and character for both the index and the Rx's, but that hasn't helped me, probably since I don't have the syntax of the command correct yet.
 
A further question is, then, what is the (more?) correct datatype (factor or char) for both index and data columns, for proper input into tapply?
 
I hope I am clear enough with my explanation.
 
best regards,
Mike Slattery
 
 
Michael W. Slattery
Geologist, Ohio EPA
50 West Town Street, Suite 700
Columbus OH, 43215
michael.slattery@epa.state.oh.us
614-728-1221 (Ph)
614-644-2909 (Fax)
<Prev in Thread] Current Thread [Next in Thread>