Hi all, I have a zoo object issue. When I create a zoo object I have following error message: "some methods for 'zoo' objects do not work if the index entries in 'order.by' are not unique." I checked if I have some duplicates in the 'Time' column, R says yes, but when I check the data set I can't explain why. Here is the code.> sum(duplicated(dataSet1$Time))[1] 5> x <- which(duplicated(dataSet1$Time))> dataSet1[x,]Time fkl010z0 tre200s0 gre000z0 prestas0 rre150z0 tde200s0 ure200s0 4046 2009-03-29 02:10:00 0.5 3.0 0 942.1 0 1.9 92.7 4047 2009-03-29 02:20:00 0.3 2.7 0 942.1 0 1.7 93.4 4048 2009-03-29 02:30:00 0.6 2.8 0 942.2 0 1.8 92.9 4049 2009-03-29 02:40:00 0.4 2.8 0 942.3 0 1.6 92.0 4050 2009-03-29 02:50:00 0.8 2.8 0 942.2 0 1.6 92.1>Enclosed is a dput file with the data set. Thank you for your help. Regards, Alex
On Sat, Dec 4, 2010 at 5:40 AM, Alexander Salim <salim at gmx.ch> wrote:> Hi all, > > I have a zoo object issue. When I create a zoo object I have following error > message: "some methods for 'zoo' objects do not work if the index entries in > 'order.by' are not unique." > > I checked if I have some duplicates in the 'Time' column, R says yes, but > when I check the data set I can't explain why. Here is the code. > > > >> sum(duplicated(dataSet1$Time)) > > [1] 5 > >> x <- which(duplicated(dataSet1$Time)) > >> dataSet1[x,] > > ? ? ? ? ? ? ? ? ? ?Time fkl010z0 tre200s0 gre000z0 prestas0 rre150z0 > tde200s0 ure200s0 > > 4046 2009-03-29 02:10:00 ? ? ?0.5 ? ? ?3.0 ? ? ? ?0 ? ?942.1 ? ? ? ?0 > 1.9 ? ? 92.7 > > 4047 2009-03-29 02:20:00 ? ? ?0.3 ? ? ?2.7 ? ? ? ?0 ? ?942.1 ? ? ? ?0 > 1.7 ? ? 93.4 > > 4048 2009-03-29 02:30:00 ? ? ?0.6 ? ? ?2.8 ? ? ? ?0 ? ?942.2 ? ? ? ?0 > 1.8 ? ? 92.9 > > 4049 2009-03-29 02:40:00 ? ? ?0.4 ? ? ?2.8 ? ? ? ?0 ? ?942.3 ? ? ? ?0 > 1.6 ? ? 92.0 > > 4050 2009-03-29 02:50:00 ? ? ?0.8 ? ? ?2.8 ? ? ? ?0 ? ?942.2 ? ? ? ?0 > 1.6 ? ? 92.1 > >> > > > > Enclosed is a dput file with the data set. >There is nothing attached. Try again putting the dput output in the body of your email or else make sure the attached file is a text file with the extension .txt . -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com
On 04/12/2010 5:40 AM, Alexander Salim wrote:> Hi all, > > I have a zoo object issue. When I create a zoo object I have following error > message: "some methods for 'zoo' objects do not work if the index entries in > 'order.by' are not unique." > > I checked if I have some duplicates in the 'Time' column, R says yes, but > when I check the data set I can't explain why. Here is the code.Remember that duplicated() doesn't return TRUE for all copies, only the second (and later ones). For example, duplicated(c(1,1,2,2,1)) returns [1] FALSE TRUE FALSE TRUE TRUE I believe the %in% operator works on zoo objects, so you can see all copies using x <- with(dataSet1, Time %in% Time[duplicated(Time)]) dataSet1[x,] Duncan Murdoch> > > >> sum(duplicated(dataSet1$Time)) > > [1] 5 > >> x<- which(duplicated(dataSet1$Time)) > >> dataSet1[x,] > > Time fkl010z0 tre200s0 gre000z0 prestas0 rre150z0 > tde200s0 ure200s0 > > 4046 2009-03-29 02:10:00 0.5 3.0 0 942.1 0 > 1.9 92.7 > > 4047 2009-03-29 02:20:00 0.3 2.7 0 942.1 0 > 1.7 93.4 > > 4048 2009-03-29 02:30:00 0.6 2.8 0 942.2 0 > 1.8 92.9 > > 4049 2009-03-29 02:40:00 0.4 2.8 0 942.3 0 > 1.6 92.0 > > 4050 2009-03-29 02:50:00 0.8 2.8 0 942.2 0 > 1.6 92.1 > >> > > > > Enclosed is a dput file with the data set. > > > > Thank you for your help. > > > > Regards, > > Alex > > > > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.