[R] Working With Variables Having Different Lengths

Rich Shepard rshepard at appl-ecosys.com
Fri Oct 21 20:09:09 CEST 2011


On Fri, 21 Oct 2011, David Winsemius wrote:

> The last part ("in the same column") does not make sense, since I was
> interpreting the term "parameter" to mean a value in a particular column. 
> Assuming these are R NA's then logical indexing:
>
> with( chemdata, chemdata[!is.na(param1) & !is.na(param2) , ])

David,

   I asked the question improperly. What I should have asked is how to
specify only non-missing values of a parameter to create a new subset.
Example (this includes NA rows):

tds.basin <- subset(chemdata, param == "TDS", select = c(param, quant, \
basin), drop = TRUE)

   When I try to add '!is.na' with the param selection I get errors.

   To be as specific as I should have been in my original message, how should
I write the above expression to exclude rows where "TDS" is missing?

Rich



More information about the R-help mailing list