[R] Question about #1 zoo-faq
Duncan Murdoch
murdoch.duncan at gmail.com
Sat Dec 4 13:52:00 CET 2010
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.
More information about the R-help
mailing list