An R package for Chronological objects which can handle dates and times, written by David James.
Questions tagged [chron]
111 questions
0
votes
2 answers
How can I transform a specific time, to a
I want to transform a string column, into a proper format.
Normally I would do something like:
print(df$Time)
> "00:00:01"
as.POSIXct(df$Time,format="%H:%M:%S")
However, my data is strange. It looks like this:
print(df$Time)
850a" "823a" NA …

R overflow
- 1,292
- 2
- 17
- 37
0
votes
1 answer
TaskscheduleR job returns fetch.write_memory error but works as a local job in RStudio on a virtual machine
I'm trying to set up an automated job that builds an csv file (by pulling aggregates from multiple MySQL databases) and sends an email out on a daily schedule. The entire script works as a local job (via RStudio jobs v1.2.1335) if the script is run…

Jacky
- 710
- 2
- 8
- 27
0
votes
1 answer
Plotting a Histogram of Time Values where the x-axis ranges from 17:30 to 7:30
I have made this question a reproducible example. Here is a portion of my data frame:
df <- structure(list(`Room Out Date` = c("2018-07-08", "2018-07-08",
"2018-07-08", "2018-07-09", "2018-07-09", "2018-07-09", "2018-07-09",
…

Andrea
- 607
- 8
- 21
0
votes
1 answer
converting times using Chron not working as intended
I have the following vector containing time stamps. These time stamps are recorded as factors.
times<-as.factor(c("8:24", "9:17","11:52","1:49","9:36"))
I want to convert them in to time objects using the chron package. And I have used the…

Nathan123
- 763
- 5
- 18
0
votes
2 answers
looping in order to create dummy variables R
I want to make a dataframe with a dummy variable that shows 1 when the time of incident is between a range of time (hours). That is what I made:
library(chron)
library(stringr)
var <- c("A", "B", "C", "D", "E", "F")
times <- c("22:40:20",…

Armando González Díaz
- 742
- 7
- 24
0
votes
3 answers
Finding previous month end date
From date 10/31/2018, I want to obtain 09/30/2018.
I tried:
PREV.PROD.DATE<-seq.Date(from=as.Date(chron("10/31/2018")),length=2,by="-1 months")
but it returns:
"2018-10-31" "2018-10-01"
How can I obtain 09/30 instead of 10/01?
Notes: I would like…

BladeVsResiduals
- 61
- 5
0
votes
2 answers
Recording timer data - how to measure milliseconds without the date?
I have a list of times in a basketball game. Here are some sample time values to show how they're stored: "11:44.0", "10:03.0", "8:35.0", "6:19.0", "0:49.9", "0:03.9"
(Minutes - no leading 0):(Seconds - with leading 0).(Tenths of a second)
It…

Nicholas Hassan
- 949
- 2
- 10
- 27
0
votes
1 answer
date variables in R
I have dates that are before 1969 stored as a character and want to change them to a date column.
This is the code I've tried
options(chron.year.expand =
function (y, cut.off = 19, century = c(1900, 2000), ...) {
…

MLPNPC
- 454
- 5
- 18
0
votes
1 answer
using chron package to format data in R
at the moment I'm trying to convert a string into time-format.
e.g. my string looks like following: time <- '12:00'.
I already tried to use the chron-Package. And my code looks like following:
time <- paste(time,':00', sep = '') time <-…

Leon
- 371
- 4
- 11
0
votes
1 answer
Convert select character variables to times in data frame in R
I'm trying to change several variables within a data frame that are currently characters into time.
I've imported only the variables I want from a csv file using
ids_dates_times <- read.csv("filename", header=TRUE, na.strings=c(".",NA),
…

Jonathan
- 1
- 2
0
votes
1 answer
Convert time (24 hours format) in character type to time in R
I have a data frame with time in character format, I need to convert it into time format. I have tried using strptime and POSIXct but it adds the date also. I just need the time.
For e.g.: TRK_DEP_TIME <- c("22:00", "14:30"......) _____ character…
0
votes
0 answers
How to get chron to convert a vector of Excel serial dates
I am trying to convert an element of a matrix from what were Excel serial dates to a vector of Date objects before using plot().
I can create a vetor and I get the expected result:
library(chron)
# set date origin as defined in Excel
…

eafpres
- 171
- 2
- 9
0
votes
0 answers
Conditional Filling and Formatting NAs in R
I downloaded the play-by-play from last year's Superbowl, and am having trouble conditionally replacing and formatting NAs.
I am primary concerned with the following two vectors in my dataframe:
> superbowl$Quarter
[1] 1 1 1 1 1 1 1 1 1 1…

DataProphets
- 156
- 3
- 17
0
votes
2 answers
Plotting with ggplot and chron - label change to %H:%M:%S
I am working with some chron data of the class 'times' and am plotting it in a scatter plot. However, I want the labeling to be in %H:%M:%S format for the variable on the x axis Tim.V. Simply adding scale_x_continuous(labels = "%H:%M:%S") to the…

TRW
- 13
- 3
0
votes
1 answer
How to filter HadISST raster data in a range of months in R?
I'm trying to study the Sea Surface Temperature (SST) correlation with tropical-cyclone activity in a certain range of months. The data I'm using is from the Hadley Centre (in NetCDF format) using the get_anual_ssts() function from the hadsstR…

Alfredo Hernández
- 132
- 2
- 10