Might this be related to the stringsAsfactors change? -- the new default is FALSE, the old was TRUE.
Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Mon, Jul 20, 2020 at 2:37 PM Rui Barradas <ruipbarra...@sapo.pt> wrote: > Hello, > > I cannot reproduce the error, your code runs as expected. Try as.POSIXct? > > Hope this helps, > > Rui Barradas > > Às 21:32 de 20/07/2020, Jeff Reichman escreveu: > > R-Help Forum > > > > > > > > Starting to work with xts objects but can't figure out what I'm doing > wrong > > when converting *.csv file with a dtg variable to a *.xts object. When > I'm > > converting to an appropriate time object all I get are NA, so that's my > > first issue. > > > > > > > > dtg <- c("1/5/2010 2:30", "1/5/2010 10:32", "1/5/2010 12:03") > > > > seq <- c(1,2,3) > > > > > > > > dat <- data.frame(dtg, seq) > > > > > > > > dat$dtg <- as.POSIXlt(dat$dtg, format = "%m/%d/%Y %H:%M") > > > > > > > > dat.xts <- xts(x = dat[,-1], order.by = dat[,1]) > > > > > > > > head(dat.xts) > > > > > > > > Sincerely > > > > > > > > Jeff Reichman > > > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > 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. > > > -- > Este e-mail foi verificado em termos de vírus pelo software antivírus > Avast. > https://www.avast.com/antivirus > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.