[R] Best way to do temporal joins in R?

Edith Mertz mertz.em at gmail.com
Fri Apr 6 15:56:59 CEST 2012


Found the blunder, last line should have been:

TideH$dt <- as.chron(paste(TideH$Date, TideH$Time), "%Y%m%d %H%M%S") 

After this I did:

Fix <- read.csv("Fix times.csv")
Fix[,"Station"] <- as.character(Fix[,"Station"])
Fix[,"Date"] <- as.Date(Fix[,"Date"],format="%d/%m/%Y")
Fix[,"Time"] <- as.character(Fix[,"Time"])
Fix[,"Fix.Type"] <- as.character(Fix[,"Fix.Type"])

Fix$DateTime<- as.chron(paste(Fix$Date, Fix$Time), "%Y%m%d %H%M%S")

ds <- Fix$DateTime
Fix$dt <- chron(sub(" .*", "", ds), gsub("[apm]+$|^.* ", "", ds)) +
 (regexpr("pm", ds) > 0)/2

Which gave an error list:

Error in convert.dates(dates., format = format[[1]], origin. = origin.) : 
  format m/d/y may be incorrect
In addition: Warning messages:
1: In unpaste(dates., sep = fmt$sep, fnames = fmt$periods, nfields = 3) :
  17955 entries set to NA due to wrong number of fields
2: In convert.dates(dates., format = format[[1]], origin. = origin.) :
  NAs introduced by coercion
3: In convert.dates(dates., format = format[[1]], origin. = origin.) :
  NAs introduced by coercion
4: In convert.dates(dates., format = format[[1]], origin. = origin.) :
  NAs introduced by coercion

Now I'm lost 4sure, help?


--
View this message in context: http://r.789695.n4.nabble.com/Best-way-to-do-temporal-joins-in-R-tp885420p4537443.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list