Skip to content

subset() missing one factor

3 messages · Jeff Newmiller, Rich Shepard

#
The data set (called 'chemdata') has 6 columns (4 factors, 1 date, 1
numeric) and I need to create subsets for each of one of the factors
('stream'). This has worked flawlessly for all but two streams which were
created yesterday.

   The command I use to create the subsets is like this:
param, quant), drop = T)

but it does not copy the dates in 'sampdate' for this and one other subset:
'data.frame':	0 obs. of  4 variables:
  $ site    : Factor w/ 138 levels "BC-0.5","BC-1",..:
  $ sampdate:Class 'Date'  num(0)
  $ param   : Factor w/ 58 levels "AGP","ANP","ANP/AGP",..:
  $ quant   : num

   The source for chemdata (accessed by read.table()) has dates for this
stream; e.g.,

RNCHS|1994-03-23|pH|7.66|RanchSpgsH|H
RNCHS|1994-01-20|pH|7.66|RanchSpgsH|H

   If I use the same command on a different stream the sampdate column
contains the dates:
param, quant), drop = T)
'data.frame':	2472 obs. of  4 variables:
  $ site    : Factor w/ 138 levels "BC-0.5","BC-1",..: 5 5 5 5 5 5 5 5 5 ...
  $ sampdate: Date, format: "1992-03-27" "1992-04-30" ...
  $ param   : Factor w/ 58 levels "AGP","ANP","ANP/AGP",..: 37 37 37 37 ...
  $ quant   : num  0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 8.08 ...

   I keep looking to see why the first fails but have not found it. Pointers
on where to look will be helpful.

TIA,

Rich
#
Might I suggest looking in chemdata? You have supplied sample records from your original data file, but the transition from that to your result is still opaque. Try to generate a reproducible sequence of steps starting with your data that we can follow along with.
Comment: you keep saying that the dates are not selected, but dates are not the only info missing; there are no records at all in the result.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.
Rich Shepard <rshepard at appl-ecosys.com> wrote:

            
#
On Wed, 28 Dec 2011, Jeff Newmiller wrote:

            
Jeff,

   Yep. I must have been sleeping and forgot to re-read the source table.
Sigh. That will cause the problem because the stream name is not in the
current chemdata.

   Fixed now; you beat me to posting that the problem's been corrected.

Many thanks,

Rich