Thanks for all your feedbacks. This is helpful.
My apologies for any inconvenience due to asterisks.
Thanks,
Bhaskar
On Wed, Aug 31, 2016 at 6:09 PM, William Dunlap wrote:
> That
> tmp1 - 30*60
> can also be done as
> tmp1 - as.difftime(30, units="mins")
> so you don't have to remember tha
That
tmp1 - 30*60
can also be done as
tmp1 - as.difftime(30, units="mins")
so you don't have to remember that the internal representation of POSIXct
is seconds since the start of 1970. You can choose from the following
equivalent expressions.
tmp1 - as.difftime(0.5, units="hours")
tmp1 - a
Building on Don's example here is something that looks a lot like what I do
every day:
Sys.setenv(TZ="UTC")
mydf <- data.frame(t1=c('2011-12-31-22-30', '2011-12-31-23-30'))
library(lubridate)
mydf$timestamp = lubridate::ymd_hm(mydf$t1)
mydf$t2 = mydf$timestamp - period(minute=30)
On Wed, Aug 31,
Try following this example:
mydf <- data.frame(t1=c('201112312230', '201112312330'))
tmp1 <- as.POSIXct(mydf$t1, format='%Y%m%d%H%M')
tmp2 <- tmp1 - 30*60
mydf$t2 <- format(tmp2, '%Y%m%d%H%M')
It can be made into a single line, but I used intermediate variables tmp1
and tmp2 so that it would be e
Hello Everyone,
I am trying a shift the time series in a dataframe (df) by 30 minutes . My
current format looks something like this :
*df$$Time 1*
*201112312230*
*201112312300*
*201112312330*
*I am trying to add an additional column of time (df$Time 2) next to Time
1 by lagging it by –
5 matches
Mail list logo