posixlt

Integer to POSIXlt

淺唱寂寞╮ 提交于 2020-01-21 20:07:59
问题 I'm starting to get a handle on how base R handles dates/times, but still have some uncertainty. Using the following data set (exert from meteorological data), I was able to convert to POSIXct and POSIXlt using the as.character() function. The Date.Time is provided in the format yymmddhhmm. Date.Time <- c(1107151300, 1107151400, 1107151500, 1107151600, 1107151700, 1107151800) WindSpd <- c(11.8, 14.5, 14.9, 14.1, 15.2, 17.1) ##Using as.character()## #Note POSIXlt this time w <- data.frame(Date

Integer to POSIXlt

回眸只為那壹抹淺笑 提交于 2020-01-21 20:05:42
问题 I'm starting to get a handle on how base R handles dates/times, but still have some uncertainty. Using the following data set (exert from meteorological data), I was able to convert to POSIXct and POSIXlt using the as.character() function. The Date.Time is provided in the format yymmddhhmm. Date.Time <- c(1107151300, 1107151400, 1107151500, 1107151600, 1107151700, 1107151800) WindSpd <- c(11.8, 14.5, 14.9, 14.1, 15.2, 17.1) ##Using as.character()## #Note POSIXlt this time w <- data.frame(Date

dplyr - mutate_each - colswise coercion to POSIXlt fails

戏子无情 提交于 2020-01-02 07:16:07
问题 I recently came across dplyr and - as a newbie - like it very much. Hence, I try to convert some of my base-R code into dplyr-code. Working with air traffic control data, I am struggling with coercing timestamps using lubridate and as.POSIXlt to parse timestamps embedded in a mutate_each() call. I need the POSIXlt format as I have to work with local times (at different locations) later on. Reading in the data delivers a data frame of characters. The following is a simplistic example: ICAO

Converting to Local Time in R - Vector of Timezones

霸气de小男生 提交于 2019-12-30 10:06:55
问题 I have a set of data from across the US that I am trying to convert into local time for each "subject". I have UTC timestamps on each event and have converted those into POSIXct format, but every time I try to include a vector of tz = DS$Factor or tz = as.character(DS$Factor) in any of the POSIXct/POSIXlt functions (including format() and strftime() ) I get an error that says: Error in as.POSIXlt.POSIXct(x, tz = tz) : invalid 'tz' value If I just enter tz = 'US/Eastern' it works fine, but of

Remove timezone during POSIXlt Conversion in R

牧云@^-^@ 提交于 2019-12-23 12:52:42
问题 I have a column in my dataframe as datetime (factor) with the values as "15-10-2017 16:41:00". I wanted this data to be converted as "2017-10-15 16:41:00". When i try to convert this, I'm getting the timezone also as output. I tried using tz="", usetz=F but no use. Any suggestions ? Code: as.POSIXlt("15-10-2017 16:41:00",format = "%d-%m-%Y %H:%M:%S") [1] "2017-10-15 16:41:00 IST" 回答1: From the help page of as.POSIXlt : "" is the current time zone which is the default. That's why it does not

Problems with dplyr and POSIXlt data

跟風遠走 提交于 2019-12-17 20:57:07
问题 I have a problem. I downloaded data and tranformed dates into POSIXlt format df<-read.csv("007.csv", header=T, sep=";") df$transaction_date<-strptime(df$transaction_date, "%d.%m.%Y") df$install_date<-strptime(df$install_date, "%d.%m.%Y") df$days<- as.numeric(difftime(df$transaction_date,df$install_date, units = "days")) Data frame is about transaction in one online game. It contains value (its payment), transaction_date, intall_date and ID. I added new column, which showndays after

Summarizing Factors and Times with Stargazer

╄→尐↘猪︶ㄣ 提交于 2019-12-11 18:45:01
问题 I am not sure why it seems so difficult to find information regarding summarizing non-quantitative variables with stargazer. I would like a summary of the following time variable (number of observations, min and max value would be great) Time<-c("2014-07-03 10:57:35 PDT", "2014-07-03 11:02:35 PDT", "2014-07-03 11:07:35 PDT", "2014-07-03 11:12:35 PDT", "2014-07-03 11:17:34 PDT", "2014-07-03 11:22:34 PDT") Time<-as.POSIXlt(Time, format="%Y-%M-%d %H:%M:%S") And a overall sample size and number

loop for list element with datetime in r

五迷三道 提交于 2019-12-11 17:03:54
问题 loop for list element with datetime in r I have a df with name mistake. I splitted the mistake df by ID. Now I have over 300 different objects in the list. library(dplyr) df <- split.data.frame(mistake, mistake$ID) Every list object has two different datetime stamps. At first I need the minutes between this two datetime stamps. Then I duplicate the rows of the object by the variable stay (this is the difftime between the sat and end time too). Then I overwrite the test variable with the