[R] importing timestamp data into R
Frede Aakmann Tøgersen
FredeA.Togersen at agrsci.dk
Fri Jan 5 08:46:41 CET 2007
Suppose that you have the timestamps in a comma seperated text file, "times.dat" then do
tid <- read.csv("times.dat", header = TRUE, colClasses = "character")
# Note the colClasses argument! If not used the columns of tid are factors by default.
time.conv <- function(x) as.POSIXct(strptime(x, format = "[%Y/%m/%d %H:%M:%S ]"))
# The value of strptime has class "POSIXlt" and needs to be converted to "POSIXct"
tid2 <- tid
for (i in 1:2) tid2[,i] <- time.conv(tid2[,i])
print(tid2)
str(tid2)
class(tid2[,1])
Med venlig hilsen
Frede Aakmann Tøgersen
> -----Oprindelig meddelelse-----
> Fra: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] På vegne af sj
> Sendt: 4. januar 2007 22:39
> Til: r-help at stat.math.ethz.ch
> Emne: [R] importing timestamp data into R
>
> I have a set of timestamp data that I have in a text file
> that I would like to import into R for analysis.
> The timestamps are formated as follows:
>
> DT_1,DT_2
> [2006/08/10 21:12:14 ],[2006/08/10 21:54:00 ] [2006/08/10
> 20:42:00 ],[2006/08/10 22:48:00 ] [2006/08/10 20:58:00
> ],[2006/08/10 21:39:00 ]
> [2006/08/04 12:15:24 ],[2006/08/04 12:20:00 ]
> [2006/08/04 12:02:00 ],[2006/08/04 14:20:00 ]
>
> I can get them into R but I cannot figure out how to convert
> them into something R will recognize as a date/time. I have
> tried using "as.Date", strptime, and chron. Any help would be
> appreciated?
>
> best,
>
> Spencer
>
>
>
> On 1/4/07, Darin A. England <england at cs.umn.edu> wrote:
> >
> >
> > Does anyone know a reason why, in principle, a call to randomForest
> > cannot accept a data frame with missing predictor values? If each
> > individual tree is built using CART, then it seems like
> this should be
> > possible. (I understand that one may impute missing values using
> > rfImpute or some other method, but I would like to avoid doing
> > that.)
> >
> > If this functionality were available, then when the trees are being
> > constructed and when subsequent data are put through the
> forest, one
> > would also specify an argument for the use of surrogate rules, just
> > like in rpart.
> >
> > I realize this question is very specific to randomForest,
> as opposed
> > to R in general, but any comments are appreciated. I suppose I am
> > looking for someone to say "It's not appropriate, and
> here's why ..."
> > or "Good idea. Please implement and post your code."
> >
> > Thanks,
> >
> > Darin England, Senior Scientist
> > Ingenix
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch 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.
> >
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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