x <- 1472562988 + 1:10; tz <- rep("EST",10) # Case 1: Works as documented ct <- as.POSIXct(x, tz=tz[1], origin="1960-01-01") # Case 2: Fails ct <- as.POSIXct(x, tz=tz, origin="1960-01-01") If case 2 worked, it'd be a little easier to process paired (time, time zone) vectors from different time zones.
David Winsemius
2011-Dec-02 20:54 UTC
[R] RFE: vectorized behavior for as.POSIXct tz argument
On Dec 2, 2011, at 2:28 PM, Jack Tanner wrote:> x <- 1472562988 + 1:10; tz <- rep("EST",10) > > # Case 1: Works as documented > ct <- as.POSIXct(x, tz=tz[1], origin="1960-01-01") > > # Case 2: Fails > ct <- as.POSIXct(x, tz=tz, origin="1960-01-01")sapply(tz, function(ttt) as.POSIXct(x=x, tz=ttt, origin="1960-01-01"),simplify=FALSE)> > If case 2 worked, it'd be a little easier to process paired (time, > time zone) > vectors from different time zones. > > ______________________________________________ > R-help at 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.David Winsemius, MD West Hartford, CT