[R] Finding Source of Error Message of 'Non-Unique Index Entries'

Rich Shepard rshepard at appl-ecosys.com
Tue Jan 3 19:53:40 CET 2012


On Tue, 3 Jan 2012, David Winsemius wrote:

> That's rather unconvincing. What does this show:
> burns.tds[ !duplicated(burns.tds) ]

   I saw that in the help page but assumed it was the opposite of duplicated;
apparently not.

burns.tds[ !duplicated(burns.tds) ]
Error in .data.frame(burns.tds, !duplicated(burns.tds)) :
   undefined columns selected

   burns.tds was generated by

burns.tds <- subset(chemdata, stream == 'BurnsCrk', select = c(site,
sampdate, param == 'TDS', quant), drop = T)

and has this structure

'data.frame':	2472 obs. of  3 variables:
  $ site    : Factor w/ 137 levels "BC-0.5","BC-1",..: 5 5 5 5 5 5 5 5 ...
  $ sampdate: Factor w/ 1056 levels "1978-03-28","1978-04-11",..: 155 156 158
161 163 164 172 175 177 309 ...
  $ quant   : num  0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 8.08 ...

   Because the data frame chemdata came from a relational table with a
primary key of (site, sampdate, param) I am having trouble understanding
where duplicate rows could have originated.

Thanks, David,

Rich



More information about the R-help mailing list