Hey all again, So I'm going through tutorials and getting a better sense of R structures.
So I made some mockup data to see if I can figure out how to load it properly. (attached) if anyone has any suggestions on a better way to structure that data please let me know. So the file has three columns, the date/time of the event, the event name, the event state (if there is one) and the event value (if there is one). I'm using the built-in date/time class of openoffice as a starting point for the date/time. I'm expecting to load this file as a data.frame where each column is a different class. Like so: > data <- read.table(file="testdata.csv",sep=",",header=TRUE,colClasses=c("zoo","factor","factor","numeric")) Unfortunately It seems there is no function for converting from "character" to "zoo": Error in methods::as(data[[i]], colClasses[i]) : no method or default for coercing "character" to "zoo" So I tried using POSIXct as suggested. Which does load the file, but it seems the times are truncated, leaving only the dates: > data Time Event State Value 1 24-10-20 BMU 20 2 25-10-20 Image 2 ...3 26-10-20 BMU 10 4 27-10-20 BMU 11 5 28-10-20 Image 3 6 29-10-20 DPMS Begin NA 7 30-10-20 Dream Begin NA 8 31-10-20 BMU 3 9 1-11-20 Image 4 10 2-11-20 BMU 50 11 3-11-20 BMU 20 12 4-11-20 DPMS End NA 13 5-11-20 Dream End NA Same results as using "Date" as the colClass. Any advice? Thanks, B. Bogart
______________________________________________ R-help@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.