posixct Questions
6
Solved
I am trying to remove the seconds from a column of hours in POSIXct format:
#"2016-04-02 10:33:45 COT" "2016-04-02 22:19:24 COT"
#"2016-04-09 17:47:13 COT" "2016-04-13 16:56:23 COT"
x <- struc...
3
Solved
This is weird: R's ifelse() seems to do some (unwanted) casting:
Lets say I have a vector of timestamps (possibly NA) and NA values should be treated differently than existing dates, for example, j...
4
Solved
I am experimenting with R to analyse some measurement data. I have a .csv file containing more than 2 million lines of measurement. Here is an example:
2014-10-22 21:07:03+00:00,7432442.0
2014-10-...
2
Solved
I have encountered some very peculiar behaviour in R. I think it might even be a bug, but I'm asking here to check if someone is familiar with it or knows a solution.
What I'm trying to do is the ...
7
Solved
Why does iterating through a Date or POSIXct object result in numeric? For example:
test = as.Date("2009-01-01")
print( class( test ) )
# [1] "Date"
for ( day in test )
{
print( class( day ) )
}
...
Homebody asked 22/6, 2011 at 3:43
4
Solved
The format of my excel data file is:
day value
01-01-2000 00:00:00 4
01-01-2000 00:01:00 3
01-01-2000 00:02:00 1
01-01-2000 00:04:00 1
I open my file with this:
ts = read.csv(file=pathfile...
7
I want to make an empty vector of POSIXct so that I can put a POSIXct in it:
vec <- vector("POSIXct", 10)
vec
vec[1] <- "2014-10-27 18:11:36 PDT"
vec
That does not work. Any ideas?
2
> t <- Sys.time()
> ct <- as.character(t)
> t - as.POSIXct(ct)
Time difference of 0.4370408 secs
The above example indicates that precision is lost when converting POSIXct to charac...
7
Solved
How would I extract the time from a series of POSIXct objects discarding the date part?
For instance, I have:
times <- structure(c(1331086009.50098, 1331091427.42461, 1331252565.99979,
13312526...
2
Solved
Assume I have created a variable containing date and time:
a <- ymd_hms("2014-01-01 12:23:34")
How do I create another variable that only has the date? That is, what should I do to transform ...
3
Solved
I have a .csv file with one field each for datetime, date and time.
Originally they are all character fields and I have converted them accordingly.
At the end of my code, if I do:
str(data)
I wi...
Acquirement asked 25/4, 2014 at 14:10
5
Solved
I have a dataset. I can choose to load it on R from a Stata file or from a SPSS file.
In both cases it's loaded properly with the haven package.
The dates are recognized properly.
But when I save i...
Brander asked 14/7, 2016 at 16:11
6
Solved
I have a very big dataset with a DateTime Column containing POSIXct-Values. I need to determine the season (Winter - Summer) based on the DateTime column. I've created a function which works fine o...
2
Solved
When I try to coerce a POSIXct date-time to a Date using as.Date, it seems to return wrong date.
I suspect it has got something to do with the time zone. I tried the tz argument in as.Date, but it ...
6
was trying to figure a way to use dplyr to count the number of occurrences for each id at each time 1 hour ahead. Tried using a for loop but it doesn't give me the desired result. Went through stac...
6
Solved
I have a dataframe with start and end times:
id start_time end_time
1 1 2018-09-02 11:13:00 2018-09-02 11:54:00
2 2 2018-09-02 14:34:00 2018-09-02 14:37:00
3 3 2018-09-02 03:00:00 2018-09-02 03:3...
3
Solved
I would like to add 1 hour to a POSIXct object, but it does not support '+'.
This command:
as.POSIXct("2012/06/30","GMT")
+ as.POSIXct(paste(event_hour, event_minute,0,":"), ,"%H:%M:$S")
retu...
4
Solved
In most cases, we convert numeric time to POSIXct format using R. However, if we want to compare two time points, then we would prefer the numeric time format. For example, I have a date format lik...
4
Solved
I have a date that I convert to a numeric value and want to convert back to a date afterwards.
Converting date to numeric:
date1 = as.POSIXct('2017-12-30 15:00:00')
date1_num = as.numeric(date1)
...
1
Solved
I'm working with some timestamps in POSIXct format. Right now they are all showing up as being in the timezone "UTC", but in reality some are known to be in the "America/New_York" timezone. I'd lik...
3
Solved
I have tried to read through stackoverflow, blogs, books etc but have been unable to find the answer on plotting time in the x-axis in the following format(HH:MM:SS.000) in R and another quantity o...
2
Solved
I have a series of observations of birds at different locations and times. The data frame looks like this:
birdID site ts
1 A 2013-04-15 09:29
1 A 2013-04-19 01:22
1 A 2013-04-20 23:13
1 A 2013-04...
2
Solved
I am interested, what "ct" and "lt" (in POSIXct and POSIXlt) mean. Are they some kind of abbreviations? E.g., does "ct" mean "calendar time" and "lt" something else?
3
I am wanting to convert date-times stored as characters to date-time objects.
However if a date time includes midnight then the resulting datetime object excludes the time component, which then thr...
3
Solved
I'm currently playing around a lot with dates and times for a package I'm building.
Stumbling across this post reminded me again that it's generally not a bad idea to check out if something can be...
1 Next >
© 2022 - 2024 — McMap. All rights reserved.