An R package for Chronological objects which can handle dates and times, written by David James.
Questions tagged [chron]
111 questions
1
vote
1 answer
Convert chron to POSIXct in GMT format
Normally, I use chron to represent date/time objects. However, I need to use some functions that work with the POSIX format, so I am trying to go from chron to POSIXct. Using as.POSIXct() seems to work but the result is in localtime instead of GMT…

point618
- 1,309
- 2
- 10
- 23
1
vote
1 answer
Running cron less then one minute- laravel
I wanna ask if is there any way to set cron in laravel less then one minute. right now execute script in while true loop is inconsiderable. I'm talking about LINUX system.

gal
- 13
- 5
1
vote
1 answer
R programming using chron package - find if a value is between two times
I try to create a new column named "Day_period" in my data frame "df.data" which takes the following values:
"Early Morning" if the values of column "Times" are between "05:00:00" and "08:59:00", using the "chron"…

Perukas
- 11
- 1
1
vote
2 answers
R data.table: Selecting minimum value of chron within group
For each group in a data.table, I want to repeat the value of the minimum (earliest) timestamp. Consider the following…

brorgschlr
- 407
- 1
- 4
- 8
1
vote
1 answer
Why recycling chron class doesn't work in data.frame in R?
data.frame recycles shorter vectors to match the length of the data frame.
test1 = data.frame(x = 1:5, date = as.Date("2013-05-01"))
x date
1 1 2013-05-01
2 2 2013-05-01
3 3 2013-05-01
4 4 2013-05-01
5 5 2013-05-01
However, it does not…

sparrow
- 1,075
- 1
- 10
- 17
1
vote
1 answer
How to convert a chron object to a numerical object of seconds since an origin in R
I have a chron object like this:
t <- as.chron("06/01/13 01:00:00", "%m/%d/%y %H:%M:%S")
and I want to convert it to seconds from origin, where the origin is:
or <- "06/01/13 00:00:00"
so what I want is that the object t become:
t <-…

Giulia
- 279
- 1
- 4
- 14
1
vote
3 answers
Problems converting variable into proper datetime format in R
My data, DATA, has a variable, TIME, for which the values print out in this format: "11/14/2006 20:10". For TIME, its mode is numeric and its class is a factor.
I need to convert TIME to a proper date/time variable (DTIME) and add the new DTIME to…

Mike L
- 486
- 5
- 16
- 33
1
vote
1 answer
Sum of times object
I just was faced with the problem, that I want to add up times in a time object, but the standard stuff (colSums, sum, rowSums) isn't working.
So, I have
time<-c("00:00:01", "01:02:00", "09:30:01", "14:15:25")
library(chron)
x <-…

Pascal
- 563
- 1
- 3
- 15
1
vote
1 answer
Trouble with placing and formatting dates in ggplot2 graph using chron
I've been trying to add appropriate dates on the x-axis of my graph, but can't figure out how to do it in a sane way. What I want is pretty simple: a date at every January 1st in between the minimum and maximum of my data set.
I don't want to…

user1807967
- 137
- 1
- 1
- 6
0
votes
1 answer
read.zoo is not returning needed date format
My initial data is in %y-%m-%d format...
using the code
returnsgamma <- read.zoo(returns, header = TRUE, sep = ",", FUN = as.chron)
the zoo file is returning values in the order %m/%d/%y
is there anyway to read.zoo and have the order of dates stay…

shay
- 1
0
votes
3 answers
Converting format %H %M %S (no leading 0s) to HH:MM:SS in r
I realize this may be a very basic question, but I am under a time crunch and cannot for the life of me figure this out. Someone altered this data I need to use to go from HH:MM:SS to %%H %%M %%S without leading 0s when these values are not double…

julianne
- 13
- 4
0
votes
2 answers
How to format the times and get a time delta in R using chron
I have two time points, I would like to obtain a time delta (notice that my times have milliseconds). I have tried to use the Chron package :
library(chron)
t1<- '2022/06/28 - 10:45:40:124'
t2<-'2022/06/28 - 10:54:50:193'
chron(t1, format='%Y/%m/%d…

Lemniscomys
- 61
- 3
0
votes
1 answer
Fix inconsistent values in a field in R requiring time values
I have a field in a R dataframe, say called OriginTime. The field has basically two types of values, read in from several excel files and rbinded together. Example df follows:
OriginTime <- c(0.777888, 0.999888, 0.25, 0.3755, "12:24", "05:59")
The…

r_user
- 1
- 4
0
votes
1 answer
Convert column of time (as character decimals from Excel) to time in R
I'm trying to convert a column of time (which I imported from Excel) that R has converted into a decimal/character string back into hh:mm:ss time. I have seen many good answers (using library chron, for example), but I keep getting these errors:
My…

Nate
- 411
- 2
- 10
0
votes
1 answer
Prevent the same job to run twice node-cron
I'm working with node and typescript, using node-cron 2.0 to schedule a background operation to run every hour.
cron.schedule("0 0 * * * *", () => {
purgeResponsesSurveys();
});
I'm concerned about what happens if the method doesn't…

s.demuro
- 399
- 2
- 15