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
-2
votes
1 answer

R: format csv file as.data.frame

I have a csv file i'm importing but some columns are not getting the correct formatting. It's very strange and I can't figure it out. The entire top row is formatting the columns as characters, instead of numeric. Believe it is getting the…
user3773444
  • 333
  • 3
  • 12
-3
votes
1 answer

Remove Rows By Specific Hours Across Multiple Dates (POSIXt format) in R

I have a dataframe and need to get rid of rows with hours 0:00, 1:00, 2:00, 3:00, 4:00, 5:00, 6:00 for all dates, leaving only 17 numbers for each day instead of 24. Then I need to calculate the maximum value for each day from those 17 values but…
rlericks
  • 3
  • 2
-3
votes
1 answer

trying to compare POSIXct objects in if statements

I have something like this within a function: x <- as.POSIXct((substr((dataframe[z, ])$variable, 1, 8)), tz = "GMT", format = "%H:%M:%S") print(x) if ( (x >= as.POSIXct("06:00:00", tz = "GMT", format = "%H:%M:%S")) & (x < as.POSIXct("12:00:00",…
Deb Martin
  • 51
  • 12
-3
votes
1 answer

sequencing by seconds w/ some simple arithmetic

x <-80 test <- seq(from=as.POSIXct('x - 1',format='%M'),to=as.POSIXct('x + 1',format='%M'),by='sec') # this doesn't actually work what I'm trying to do is create a sequence here in increments of seconds, but I would like to incorporate some…
Doug
  • 597
  • 2
  • 7
  • 22
-4
votes
2 answers

How to Find a Conditional Difference by Day in R

I have a numerical variable, call it "Blah". Blah is measured at various time intervals throughout the day and is an always increasing count. I want to find the difference between the first and last observation of Blah for each day and produce a…
Michael
  • 1,537
  • 6
  • 20
  • 42
1 2 3
70
71