Questions tagged [posixlt]

Class `POSIXlt` more conveniently represents the result of Class `POSIXct` (the number of seconds since the beginning of 1970) as a numeric vector of more directly accessable values for seconds, minutes, hours, days, months, years etc.

Class POSIXct represents the (signed) number of seconds since the beginning of 1970 (in the UTC time zone) as a numeric vector. Class "POSIXlt" is a named list of vectors representing

sec - 0–61: seconds.

min - 0–59: minutes.

hour - 0–23: hours.

mday - 1–31: day of the month

mon - 0–11: months after the first of the year.

year - years since 1900.

wday - 0–6 day of the week, starting on Sunday.

yday - 0–365: day of the year.

isdst - Daylight Saving Time flag. Positive if in force, zero if not, negative if unknown.

zone - (Optional.) The abbreviation for the time zone in force at that time: "" if unknown (but "" might also be used for UTC).

gmtoff - (Optional.) The offset in seconds from GMT: positive values are East of the meridian. Usually NA if unknown, but 0 could mean unknown.

151 questions
0
votes
2 answers

Convert factor to POSIXlt with propagating date in R

I have a vector with time information and a date noted only once per day. I need to convert the vector into a usable format such as POSIXlt. The times are ordered, where all times (%H:%M) within a day belong to the last date noted before the…
nya
  • 2,138
  • 15
  • 29
0
votes
1 answer

How to work with POSIXlt in R

I am trying to do some analysis with a csv file that I have loaded into R. I was doing the following to access specific values via test[[3]][[1]] for example to get the specific value: test <- read.csv(file = "test.csv") test <-…
mangix
  • 41
  • 4
0
votes
2 answers

R AUC of multiple samples in time series

I would like to calculate the area under curve for a time series for multiple samples. the time variables of the data type POSIXlt my data is set up like this day = c(rep(1, 4), rep(2,4)) time = c("2016-11-10 11:40:42", "2016-11-10 11:45:42",…
MLyall
  • 119
  • 9
0
votes
2 answers

Selecting a rows from a pandas frame based on a time that has been converted into datetime format and stripped from a POSIX time stamp, python

I am using the code below to pull data from Google Finance. The timestamp is in POSIX form, so it is converted into data time. When I try to filter it based on a time criteria (14:35:00), it returns an empty table. I suspect it has to do with the…
0xsegfault
  • 2,899
  • 6
  • 28
  • 58
0
votes
1 answer

Filtering out rows based on a criteria of number of months of data

I have a data frame like the one below: df Device_No Consumer.Account.Id Transaction_Date Transaction.Amount Transaction.Liter TXT_Month 1 1100110065 1.01014e+11 2014-01-02 13:04:45 0.09 0.3 1 2 …
0
votes
0 answers

changing timezone of a column in a data frame to different timezones

I have the following data frame: time_df=data.frame(id=c(1,2,3,4,5,6,7), …
chessosapiens
  • 3,159
  • 10
  • 36
  • 58
0
votes
0 answers

Format time in R

I'm new to R, but need help formatting just one variable in my data frame: > str(g.2015.1990$START.TIME) int [1:60464] 712 606 1238 708 709 707 407 707 612 1237 ... Although R interprets this as an integer, it is a time variable formatted in 3-4…
0
votes
2 answers

extracting hour and minute from character column in r

I have the following data frame,the data set is already imported from a database table and created_at column has character type: sale_id created_at 1 2016-05-28T05:53:31.042Z 2 2016-05-30T12:50:58.184Z 3 …
chessosapiens
  • 3,159
  • 10
  • 36
  • 58
0
votes
0 answers

Why are POSIXlt dates changed when converting a list into a data.frame in R?

I have these lines of an R-script: date1999 = as.POSIXlt("1999-01-01", tz = "Etc/GMT-1") date2001 = as.POSIXlt("2001-01-01", tz = "Etc/GMT-1") dates=c(date1999, date2001) print(hours(dates)) # -> [1] 0 0 l=list(dates=dates) print(hours(l$dates)) #…
Leolo
  • 416
  • 1
  • 5
  • 12
0
votes
0 answers

How to either calculate with POSIXlt or convert POSIXlt class into POSIXct in R?

I was trying to find an answer to my question as mentioned above. I am trying to calculate the minutes difference between datetime formated cells in two separate columns. However, the input is already in POSIXlt and it seams (for me also…
0
votes
1 answer

Turning date strings into usable date objects in R

My strings look like: [1] "Sunday, April 10, 2016" "Saturday, April 16, 2016" I would like to apply an algorithm in R so they each read something like this and have a Class POSIXlt or POSIXct: [1] "04/10/2016" "04/16/2016" I tried to use…
IRNotSmart
  • 351
  • 6
  • 18
0
votes
1 answer

R data.table convert date column to month

I have the following toy data.table x = data.table(dt = c('2015-01-01','2015-02-01','2016-04-01')) I'm trying to add an extra column to the table which has the three letter abbreviation of the date. I tried x$dt = strptime(x$dt,'%b') but it…
broccoli
  • 4,738
  • 10
  • 42
  • 54
0
votes
0 answers

Checking whether two time vectors overlap in R

I have two time stamp data A and B. A = c("2015-11-02 08:30:00.054", "2015-11-02 08:30:00.060", "2015-11-02 08:30:00.060", "2015-11-02 08:30:00.062", "2015-11-02 08:30:00.952") B = c("2015-11-02 08:30:00.016", "2015-11-02 08:30:00.029", "2015-11-02…
jay2020
  • 451
  • 1
  • 3
  • 12
0
votes
1 answer

Use split on dataframe with POSIXlt as critera

I am attempting to split and summarize some data based on time. There is some redundant info here which shouldn't interfere with this post. I want to split the data based on FiveMinBar and then get the first opening price, the max high, the min low,…
mks212
  • 901
  • 1
  • 18
  • 40
0
votes
0 answers

if or statement to create a new column from time data in R

I have a small dataset containing some date/time information. e.g.: type start end price time rental location A Location B 0 23:50:00 rental location A Location B 0 18:32:00 rental location A Location B 0 …