Dear list, I just had a function (as.ltraj in Adehabitat) give me the following error: "Error in as.ltraj(xy, id, date = da) : non unique dates for a given burst" I checked my dates and got the following:> dupes<-mydata$DateTime[duplicated(mydata$DateTime)] > dupes[1] (07/30/02 00:00:00) (08/06/03 17:45:00) Is there a reason different dates would come up as duplicate values? I would prefer not to have to delete them if I don't have to. Any suggestions on how to get R to realize they are different? Thanks, Tim Tim Clark Department of Zoology University of Hawaii
What you are reporting is that there are two duplicated dates in your data. 'duplicated' returns a logical vector that is TRUE for the second and subsequent duplicates. Notice what is returned:> x <- c(1,2,2,3,4,4,5,6,4,7,3) > x[duplicated(x)][1] 2 4 4 3>On Thu, Jul 23, 2009 at 8:50 PM, Tim Clark<mudiver1200 at yahoo.com> wrote:> > Dear list, > > I just had a function (as.ltraj in Adehabitat) give me the following error: > > "Error in as.ltraj(xy, id, date = da) : non unique dates for a given burst" > > I checked my dates and got the following: > >> ? dupes<-mydata$DateTime[duplicated(mydata$DateTime)] >> dupes > [1] (07/30/02 00:00:00) (08/06/03 17:45:00) > > Is there a reason different dates would come up as duplicate values? ?I would prefer not to have to delete them if I don't have to. ?Any suggestions on how to get R to realize they are different? > > Thanks, > > Tim > > > > Tim Clark > Department of Zoology > University of Hawaii > > ______________________________________________ > 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. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?
Look at results of table( mydata$DateTime ) and I think you will see that some are duplicated. Specifically, the two in your dupes object. -Don At 5:50 PM -0700 7/23/09, Tim Clark wrote:>Dear list, > >I just had a function (as.ltraj in Adehabitat) give me the following error: > >"Error in as.ltraj(xy, id, date = da) : non unique dates for a given burst" > >I checked my dates and got the following: > > > dupes<-mydata$DateTime[duplicated(mydata$DateTime)] >> dupes >[1] (07/30/02 00:00:00) (08/06/03 17:45:00) > >Is there a reason different dates would come up as duplicate values? >I would prefer not to have to delete them if I don't have to. Any >suggestions on how to get R to realize they are different? > >Thanks, > >Tim > > > >Tim Clark >Department of Zoology >University of Hawaii > >______________________________________________ >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.-- -------------------------------------- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA 925-423-1062
I had the same error "Error in as.ltraj(xy, id, date = da) : non unique
dates
for a given burst", but from a different cause, that I'd like to share
in
case others have the same issue.
My data came from GPS collars that collected dates and time in Greenwich
Mean Time (GMT). However, the package automatically uses time appropriate
for your local area. My data had been collected during October when
Australia switches from standard time to summer time. Thus the times 0200h
and 0230h on 6 October did not exist and were perceived as 'non unique
dates' between 0100h AEST and 0300h AEDT. This can easily be fixed by
specifying the time zone when extracting the dates using as.POSIXct
GPSdata$datetime <- (strptime(paste(GPSdata$Date, GPSdata$Time), "%Y %m
%d
%H:%M:%S"))
GPSdata$datetime <- as.character(GPSdata$datetime)
when <- as.POSIXct(GPSdata$datetime, tz="GMT")
foxdata <- as.ltraj(xy = GPSdata[,c("North.", "East.")],
date = when, id GPSdata$Animal)
Bronwyn Hradsky
Department of Forest & Ecosystem Science
University of Melbourne
--
View this message in context:
http://r.789695.n4.nabble.com/Duplicated-date-values-aren-t-duplicates-tp897178p4701489.html
Sent from the R help mailing list archive at Nabble.com.