RhiKirton / WildlifeDI_ESRI

ESRI pres data
0 stars 0 forks source link

POSIX column empty #1

Open RhiKirton opened 4 years ago

RhiKirton commented 4 years ago

I am trying to create a POSIX column to enable me to create ltraj objects with my data. For some reason it will not work, even though I am pretty sure I'm using the correct code.

Read in and format deer data

deerdf <- read.csv('C:/Users/RKirton/Documents/Data files/Oswalt_Ranch_2008_2009_Master_Database_2_212014.csv',stringsAsFactors=F) deerdf$POSIX <- as.POSIXct(strptime(paste(deerdf$Day,"/",deerdf$Month,"/",deerdf$Year," ",deerdf$Hour,":",deerdf$Minute,":",deerdf$Seconds,sep=""),"%d/%m/%y %I:%M:%S %p"),tz='CST6CDT') deerdf$ID2 <- paste(deerdf$StudyYr,'',deerdf$ID,sep='')

Read in the hunter data - Format for correct date time.

huntdf <- read.csv('C:/Users/RKirton/Documents/Stephen_files/SuperMerge.csv',stringsAsFactors=F) huntdf$DateTime = paste(huntdf$Date, huntdf$Time) huntdf$POSIX <- as.POSIXct(strptime(huntdf$DateTime, "%d/%m/%y %I:%M:%S %p"),tz='CST6CDT')

check for duplicate fixes (times) adn NA's

for (i in unique(huntdf$ID)){ ind <- which(huntdf$ID == i)

check for duplicate fixes (times)

ind1 <- duplicated(huntdf$POSIX[ind]) io <- ind[ind1] if(length(io)>0) huntdf <- huntdf[-io,] }

Remove any NA's from the data

huntdf <- huntdf[-which(is.na(huntdf$POSIX)),]

greenham22 commented 4 years ago

Hi, did you end up solving this problem? I'm having the same one right now and would love to hear about how you resolved this. Thanks ~