Questions tagged [posixct]

In the R language, the classes "POSIXct" and "POSIXlt" are representing calendar dates and times (to the nearest second).

The classes POSIXct and POSIXlt are representing calendar dates and times in R.

The class POSIXct represents the (signed) number of seconds since the beginning of 1970 (in the UTC timezone) as a numeric vector.

Class POSIXlt is a named list of vectors representing

  • sec: seconds (0-61)
  • min: minutes (0-59)
  • hour: hours (0-23)
  • mday: day of the month (1-31)
  • mon: months after the first of the year (0-11)
  • year: years since 1900
  • wday: day of the week, starting on Sunday (0-6)
  • yday: day of the year (0-365)
  • isdst: Daylight Savings Time flag. Positive if in force, zero if not, negative if unknown.

POSIXct is more convenient for including in data frames, and POSIXlt is closer to human-readable forms. A virtual class POSIXt exists from which both of the classes inherit.

References:

1056 questions
0
votes
0 answers

posixct date to Java date

How can I convert in Java a POSIXct date to a formatted date like "y-M-d". I've been looking around but I didn't found anything. I read from a file these lines:…
fpinero
  • 5
  • 2
0
votes
1 answer

POSIXct back to character, specific format

lets say we have a character vector of like: vec <- "1/1/2000" at some pont we turn this into a date via newvec <- as.POSIXct("1/1/2000", format = "%d/%m/%Y") Now let say we want to make it a character again we can do: as.character(newvec) [1]…
user1320502
  • 2,510
  • 5
  • 28
  • 46
0
votes
0 answers

How to plot when Date and hour are in separate field (and are factors) using ggplot2 in R

Related this post: How to plot when Date and hour in separate field using ggplot in R I have the data frame: head(d[, c(1,2,7)], 10) date hour total_sess 2 2014-04-07 00 115 3 2014-04-07 01 3 4 2014-04-07 16 …
user3006691
  • 435
  • 3
  • 7
  • 16
0
votes
2 answers

Get data between certain timestamps in R

I have the following data frame: >head(d) Smed Time TTFB 1 186 2014-03-19 20:13:00 6 2 196 2014-03-19 21:23:00 0 3 186 2014-03-19 19:33:00 22 4 186 2014-03-19 14:43:00 134 5 186 2014-03-19 23:53:00 36 > str(d) $ Smed …
user3006691
  • 435
  • 3
  • 7
  • 16
0
votes
0 answers

data table v1.8.8 POSIX dates convert to numeric after 'by' operation

I was attempting to add a new column to a data table which would be of class POSIXct, but I found that the data keeps getting converted to numeric for some reason ... but only when I use 'by'. Is this a bug, or a limitation, or am I doing something…
pteehan
  • 807
  • 9
  • 19
0
votes
1 answer

Summarising a POSIX (date/time) referenced vector in another date/time referenced vector

Hi all R efficiency gurus (and people with a similar question to me), This is an efficiency question. I have some very large data set. One data.frame contains data from one instrument with a POSIX date and time with values at a very high frequency.…
userX
  • 305
  • 2
  • 15
0
votes
1 answer

Convert POSIX date and time to UNIX time in R

I am looking for a way to convert a simple POSIX time stamp like this > time [1] "2014-02-19 17:40:41" into an UNIX time stamp. All solutions I found only worked the other way round. Can anybody provide some help? Thanks in advance!
chringel21
  • 126
  • 3
  • 10
0
votes
1 answer

Subset time series data into defined intervals

I am trying to subset, or filter, data into a defined time interval. Can you help me subset the following data into 2-minute time intervals? I have looked at Lubridate, split(), and cut() but cannot figure out how to properly do this. I've looked…
stokeinfo
  • 135
  • 1
  • 2
  • 8
0
votes
2 answers

How to convert a character date into POSIX time without loss in precision

I have the following date which I want to convert into POSIX time. I followed this answer but there's a difference between the input and the output date if I convert the date back. char_date <- "2012-04-27T20:48:14" unix_date <-…
CptNemo
  • 6,455
  • 16
  • 58
  • 107
0
votes
1 answer

Converting year, day of year, and HHMM to yyyy-mm-dd HH:MM

When I load data from a CSV file into R I receive the following data frame dd <- data.frame(year = as.integer(c(2007,2007)), doy = as.integer(c(156,156)), HHMM = as.integer(c(1200,1200)), var =…
KatyB
  • 3,920
  • 7
  • 42
  • 72
0
votes
1 answer

How to prevent NA's when binding date and time variables?

In my dataset I have a column with the date and a column with the time: YYMMDD TIME 19861226 74751.00 19871214 204951.05 19891201 200914.35 19910215 21116.54 19910425 102631.58 19910808 40114.65 When I want to bind these two into one variable…
Jaap
  • 81,064
  • 34
  • 182
  • 193
0
votes
1 answer

Summarizing intervals of missing data in POSIX time series

I have a time series of hourly precipitation data that I am trying to run through a QA/QC routine. One thing I would like to do is create a histogram of the count of intervals with missing data grouped by the length of time the data are missing for,…
Iceberg Slim
  • 451
  • 6
  • 14
0
votes
0 answers

transforming numeric values to POSIXct

I'm having a problem transforming my numeric values to POSIXct after I'd merged two data frames together. I had some variated data and wanted to make periods of one day. It worked fine, so until now I have a data frame with time stamps of one day…
0
votes
1 answer

Rounding Date in every second column of data frame

Bit of an unusual request, but I am trying to round up datetimes in every second column of a data frame. I think I can already identify every second column (using df[c(T,F)], but am having trouble working out how to apply the transformation to these…
0
votes
1 answer

Subsetting based on co-occurrence within a time window

I am having trouble subsetting data based on different attributes in different columns. Here is a dummy data set with species, area where it was found, and time (already in POSIXct). SP Time Area B 07:22 1 F 09:22 4 A 09:22 1 C 08:17 3 D 09:20 1 E…
Karl
  • 67
  • 4