An R package for Chronological objects which can handle dates and times, written by David James.
Questions tagged [chron]
111 questions
0
votes
1 answer
How to change date format to 2019-Feb-07 to 2019-02-07 in R?
I have a code that reads in data from a .txt file, in which there is a date column dd/mm/yyyy and time column HH:MM:SS and I want to merge the columns into one date time column yyyy/mm/dd HH:MM:SS.
The data frame structure is:
structure(list(V1 =…

Alex
- 47
- 7
0
votes
2 answers
Running chron job on a single instance of spring service deployed on aws
I have a requirement to run a chron job weekly on only a single instance of a java spring service running on multiple aws instances in a cluster. I have the freedom to spawn an instance of same service in a different cluster for handling the special…

Aditya Raman
- 309
- 8
- 19
0
votes
1 answer
Convert chr to time format using chorn
I am trying to transform my date dataset from chr to time format.
Here is my code :
time<-f1%>%
mutate(`ymd_hms(Timestamp)`=strftime(f1$`ymd_hms(Timestamp)`, tz="GMT", format = "%H:%M:%S"))%>%
transform(as.numeric(f1$SpotPrice))
…

NIrbhay Mathur
- 153
- 1
- 1
- 10
0
votes
1 answer
How to programmatically ad a character to a string in R
I apologize in advance if this has been posted elsewhere. I am new to R, and I am having trouble manipulating a dataframe.
I have a column in my dataframe that contains times in the format of hh mm ss. However, some values only have a single "0" in…

peter-j-schmidt
- 31
- 3
0
votes
0 answers
xset in BASH script does not work under Cron
To learn about BASH scripting, I set myself the objective to write a Cron script which shuts down a PC with Mint 20 when activity on the Ethernet interface dropped below a threshold over an 1 hour.
I mainly (but not exclusively) use the PC as…

Pete
- 1
- 2
0
votes
3 answers
R Convert char to time
I have a column of military time values, df1$appt_times in the format of "13:30" All of them, 5 characters, "00:00". I have tried POSIXct but it added today's date to the values. I have also tried lubridate and couldn't get that to work. Most…

Retep Yarrum
- 27
- 6
0
votes
1 answer
How to break a 24 hour day into 4 hour time buckets (Chron())
Using library(chron)
Here is the
structure(c(0.876736111111111, 0.876666666666667, 0.876435185185185,
0.876354166666667, 0.876319444444444, 0.876284722222222, 0.876134259259259,
0.876122685185185, 0.876006944444444, 0.87587962962963,…

Michael Scott
- 49
- 5
0
votes
0 answers
How to plot time intervals without date components on the x-axis using dygraph and xts function?
I'm trying to plot time series with the dygraph function. A single diagram represents the course of a specific variable on different days. Since series correspond to different days, I would like the x-axis to be date-agnostic. It should only contain…

SkogensKonung
- 601
- 1
- 9
- 22
0
votes
1 answer
Finding the Mean and SD of time variables, taking times past midnight into account in R
I am trying to figure out how to take the mean and SD of bedtimes, but I am having difficulty managing times after midnight. These concepts make sense logically (I think) but figuring out how to code it in R is tricky.
Right now, those pull the mean…

Zach
- 21
- 3
0
votes
1 answer
R subsetting a big dataframe based on date values
data frame with following strucutre : 'data.frame': 4371 obs. of 6 variables:
"$ tg : num 0.0403 0.0404 0.0404 0.0404 0.0405 ...
$ date : Factor w/ 4371 levels "2/20/2020 10:00",..: 841 842 843 844 845 846 847 848 849 850 ...
$ lgp_bar:…

Pri
- 21
- 7
0
votes
1 answer
add minutes to time of day (hh:mm), start from new day if time > 24
I have a time variable as hh:mm. I want to add numeric minutes to that. If time goes over 24:00, it should count a new day.
For example: time starts at 23:45, delay is 20 minutes, real start time is 00:05. Example data frame:
df <-…

Schillerlocke
- 305
- 1
- 14
0
votes
1 answer
Calculate time difference between two hh:mm variables over the span of a day
I have an issue calculating the time difference between two variables. To be exactly the time between falling asleep and waking up. I thought about using chron for doing so and this is my example.
DF <- data.frame(time_start = c("20:00", "21:30",…

Schillerlocke
- 305
- 1
- 14
0
votes
1 answer
getting wrong output when changing hours(not formatted)into hh:mm in R
I have a column within a data frame containing hours that was created by dividing by 60 from another column that is comprised of minutes and would like them formatted to hh:mm
I found this post to be helpful:
Convert a decimal number to HH:MM:SS in…

BigBird
- 5
- 3
0
votes
1 answer
Create a sequence of times in R?
I want to create a sequence of times 00:00 - 12:00 and 12:00 to 00:00 with 10 minutes step.
How can I do this in R?
I have tried with:
library(chron)
t <- merge(0:23, seq(0, 50, by = 10))
chron(time = paste(x$x, ':', x$y), format = c(times =…

SteveS
- 3,789
- 5
- 30
- 64
0
votes
2 answers
shell script won't change directory and execute python script
So i have a file success.sh
python3 /home/ubuntu/foo.py
and this runs in Cron with:
* * * * * /home/ubuntu/success.sh >> /tmp/cron_output
where foo.py is simply
print("DSVSDVDSVSDFDS")
however as soon as I try to run what i actually want to run…

kianwhatt
- 13
- 3