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
0 answers

How to assign a POSIXlt element to a vector

I have a column of date-time variables ex, which I want to randomly sample one element from and assign it to a vector. However, I don't get the result if I do: > sample(ex,1) [1] "2017-12-24 10:42:39 GMT" > some_vector<-rep(NA,1) >…
halo09876
  • 2,725
  • 12
  • 51
  • 71
0
votes
2 answers

Loop between posixlt in R

I am encountering an error in R when trying to loop over time. Here is a subset of my dataframe (containing 120000 rows). time value mean group 1 2017-01-01 12:00:00 0.507 0.5106533 NA 2 2017-01-01 12:05:00 0.526 0.5106533 …
Doc Martin's
  • 341
  • 1
  • 3
  • 11
0
votes
0 answers

Plot a certain day range for histogram R

I have more than thousands of data with posixt format. eg:"Tue Feb 11 14:17:41 +0000 2014" The data spans from february 11 to february 16. I want to plot a histogram that plots only the data on february 15. I've tried hist(newtime, "hours",plot =…
jerome22
  • 1
  • 1
0
votes
2 answers

loop for list element with datetime in r

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…
Melanie
  • 3
  • 2
0
votes
1 answer

replacing NA's in a Large POSIXct with Sys.time()

I have a large POSIXct of around 70,000 elements. resolutionDate <- c(as.POSIXct(data$Resolution.Date, format = '%b %d, %Y')) The code above changes the values from Jun 5, 2018 3:21 PM to 2018-06-05. However, some values are NA and I would like to…
cool_beans
  • 131
  • 1
  • 5
  • 15
0
votes
1 answer

Is as.list() not possible on POSIXlt atomic vectors?

as.list() does not work on a POSIXlt-classed atomic vector. x <- as.POSIXlt(Sys.time() - 0:2) as.list(x) # [1] "2018-05-19 12:06:38 PDT" "2018-05-19 12:06:37 PDT" # [3] "2018-05-19 12:06:36 PDT" So how do I easily turn the vector x into a list? …
Rich Scriven
  • 97,041
  • 11
  • 181
  • 245
0
votes
1 answer

R: $ operator invalid for atomic vectors Error with POSIX

i may be missing something really obvious here, could you help me? when i send a date object to seLocalize() function, it returns me as expected for the code that follows (i sent 14-mar-18 and returned 13-mar-18) seLocalize <- function(dataTeste) { …
francisco
  • 3
  • 1
0
votes
2 answers

Rounding time to the next milisecond

Consider the date: options(digits.secs = 6) library(lubridate) this_special_date <- with_tz(as.POSIXct(strptime('2017-11-20 23:00:00.051438000', '%Y-%m-%d %H:%M:%OS', tz = 'GMT')), …
user189035
  • 5,589
  • 13
  • 52
  • 112
0
votes
3 answers

Obtaining hourly means of time series with 10 minutes period

i have a dataframe which has 10 columns. First column is belongs to date in POSIXIt format and it has also date and time. Last nine columns belong to the variables. Data can be seen at the below. str(combined) 'data.frame': 60118 obs. of …
Cem
  • 108
  • 11
0
votes
1 answer

R - Date/Time Calculations

My Question is divided into 2 parts: 1st part: I have a function, getdata() which I use to pull information for a date range. get_data <- function (fac_num, start_date, end_date) { if (!(is.null(fac_num) | is.null(start_date) |…
0
votes
1 answer

R - Mean of every nth Value from column in data frame, numeric & POSIX

I get some data from different sensors including a timestamp every minute. For visualizing my data I would like to summarize every 10 values with mean. My data looks like this: Temp Humidity Pressure Time 1 21.9 66.1 …
psalterium
  • 65
  • 4
0
votes
0 answers

Warning message of timezone in R POSIXlt(as.POSIXlt(x)

I've downgrade R in MacOS from 3.4 to 3.2 Now I'm having these warning messages Warning messages: 1: In format.POSIXlt(as.POSIXlt(x), ...) : unknown timezone 'America/Belem' 2: In format.POSIXlt(as.POSIXlt(x), ...) : unknown timezone 'GMT' 3: In…
Tetraodienne
  • 275
  • 1
  • 2
  • 7
0
votes
1 answer

Converting to datetime resulting in NA

I have a data frame with the following attributes and fields: print(sapply(df1, typeof)) SurveyUserStart "integer" print(df1) SurveyUserStart 1 2016-10-17 08:55:13 2 2016-04-24 14:31:12 3 2016-09-01 15:17:54 4 2016-07-20 11:26:56 I am…
Techno04335
  • 1,365
  • 6
  • 22
  • 43
0
votes
0 answers

Format Time in R independent of a Date

How do I format time independent of a date in R? I have a time vector that I would like to add and subtract; however, when I format the vector as POSIXct(), POSIXlt(), or strptime() R attaches a date to it: > sample V1 1 1:23 2 5:20 3 2:28 4…
DataProphets
  • 156
  • 3
  • 17
0
votes
1 answer

Subset data based on pentad dates with leap year

I'm trying to subset the following data by pentad dates. Pentad means non overlapping 5 day average. For leap years, Pentad 12 includes February 29 (6 days average instead of 5): Link to Data Link to pentad dates Here's my code: library(stringr) dat…
ichabod
  • 121
  • 1
  • 2
  • 11