[R] NADA Package: Referencing Data Frame Columns

Rich Shepard rshepard at appl-ecosys.com
Wed Aug 8 22:42:19 CEST 2012


On Wed, 8 Aug 2012, MacQueen, Don wrote:

> Specifically, since it has only a single detection indicator column
> (ceneq1), it implies that within any single sample either all the analytes
> were detected, or all were not. Not what I would expect.

Don,

   I have been thinking about this and wondered whether the cast format was
appropriate just for the reason there's only a single censored indicator.
I'm glad you confirmed this as the/one problem.

> As to your larger question of which layout is appropriate for use with
> NADA functions, the answer is that either can be used. The "trick" is to
> use the appropriate syntax to extract the values needed to pass the data
> to a NADA function.

   And I've not discovered this in the time I spent trying different syntax.

> For the long format you subset the rows, then pass the appropriate
> columns. Here's one way:
>
>   with(subset(chem, param=='AgDis') , ros(quant,ceneq1))

   This makes a lot of sense. I was thinking that I needed to create separate
data frames for each parameter but subsetting on the fly is much more
efficient and elegant.

> Hope this helps.

   It certainly does! Thanks.

> (p.s., I still think you'll be better off in the long run if you store
> site, param, and maybe era, as character objects, not factors.)

   I need to research this because I thought that factors were character
objects used to partition quantities into groups.

Regards,

Rich



More information about the R-help mailing list