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

as.POSIXct error can't find the bug

I am trying to convert my date and time to a format that R recognsied to sort my data. I have a code that has worked with previous datasets but here I cannot find for the life of me why it doesn't work. It might be something simple but I am getting…
0
votes
1 answer

Counting the Occurrences of Regular Time Spans in a Set of Time Intervals R

Given a data set like below. I would like to count how many times a particular hour of the day (00:00, 01:00, ...., 22:00, 23:00) falls completely within any of the given intervals. The date of occurrence doesn't matter. Just the overall count.…
Michael
  • 1,537
  • 6
  • 20
  • 42
0
votes
0 answers

working with linux dates column in R

I have multiple pictures in a folder and each picture has a timestamp (in linux format) in it's name. I have provided an example of a timestamp on line3. My line 3 runs fine. But I get an error with 4th line. any hints? my error is Error in…
user2543622
  • 5,760
  • 25
  • 91
  • 159
0
votes
1 answer

R! posIXCT in sqldf

first time question, so if I missed something I apologize: I imported an excel file into R! using XLconnect, the str() function is as follow: data.frame': 931 obs. of 5 variables: $ Media : chr "EEM" "EEM" "EEM" "EEM" ... $ Month …
0
votes
1 answer

How can I create a POSIXct vector in ffdf?

I've had a look around and can't quite seem to get a grasp of is going on with this. I'm using R in Eclipse. The file I'm trying to import is 700mb with around 15mil rows and 6 columns. As I was having problems loading in I have started using the ff…
user1587280
0
votes
2 answers

Removing rows containing specific dates in R

Disclaimer: I am going to come out of this looking silly. I have a data frame containing a column which has a date of class POSIXct. I am trying to remove some of the rows containing specific dates- public holidays. I tried to do that using this: >…
vagabond
  • 3,526
  • 5
  • 43
  • 76
0
votes
1 answer

Unable to convert this Character type to a proper Date type in R

I have a data set that has a column for dates (emp2$hiredate) which is in char format. While converting it to Date, I'm getting the following error : > date1 <- emp2$hiredate[2] > str(date1) chr "20FEB1981" > as.POSIXct(date1) Error in…
sunitprasad1
  • 768
  • 2
  • 12
  • 28
0
votes
2 answers

R help in subsetting daily range with POSIXct

I am trying to subset an interval inside of each day of a POSIXct time series. Suppose I have a sample set of 3 days, sampled every 15 minutes. sample <- seq(as.POSIXct("2000-01-01 00:00:00"),as.POSIXct("2000-01-03 24:00:00"),by=15*60) [1]…
pat
  • 617
  • 8
  • 17
0
votes
0 answers

R: Rank method changes my index format from Date to POSIXct

I have the following problem. I have a XTS containing a date column and several valuations, which should be ranked (biggest = best rank). So my original XTS is test: > str(index(Test)) Date[1:235], format: "1995-01-31" "1995-02-28" "1995-03-31"…
MichiZH
  • 5,587
  • 12
  • 41
  • 81
0
votes
1 answer

Class changing when assigning rows from vector. R 3.10, Windows 7, 64bit

I have a POSIXct class vector containing am hours and I want to replace the values in a data frame containing a character class column. When I do the replacement the class changes to character. I'm proceeding as follows: class(data2014.im.t[,2]) [1]…
Panchito
  • 337
  • 1
  • 3
  • 12
0
votes
1 answer

How to add millisecond on timestamp correctly using R

the unit of tick_count column is 100 millisecond. I want to plus the tick_count time on date_time. But the result doesn't execute addition correctly. For example, the second value should be "2014-08-15 12:51:02.6 EEST" rather than "2014-08-15…
chenchenmomo
  • 233
  • 1
  • 3
  • 16
0
votes
1 answer

apply POSIXct to a data frame

I have a data frame named df like that id time 1 1392825600 2 1392825597 3 1392825587 where is time the time in seconds since epoch at UTC (the local time of the data is the Hong Kong timezone) I would like to put…
user2741700
  • 881
  • 3
  • 11
  • 21
0
votes
1 answer

R - update datetime to 9am of the closest working day in the future

A datetime column of my dataframe is in the POSIXct format, e.g. "2014-08-08 14:22:00". I'd like to update such datetime values if they fall out of working hours. The target value needs to be the closest 9am of a weekday in the future. This…
MichM
  • 886
  • 1
  • 12
  • 28
0
votes
0 answers

05:00:00 - 28:59:59 time format function

I want to create function which handles question: 05:00:00 - 28:59:59 time format When I run script from that question it's working but when I run the function: pal <- NormalDates(data,Date,Time.start) Error in unclass(e1) + unclass(e2) : …
BiXiC
  • 933
  • 3
  • 9
  • 29
0
votes
1 answer

Divide vector of timestamps (/ POSIXcts) into n-minutes intervals in R

I have a huge vector of timestamps (double type in R). This is a column in my data.table object. I want to divide these observations into n-minutes intervals - I want to have a character vector representing e.g. time of the first value for this…
Marta Karas
  • 4,967
  • 10
  • 47
  • 77