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...
Schecter asked 28/9, 2016 at 19:58

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...
Levania asked 30/6, 2015 at 8:35

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-...
Deferment asked 4/5, 2015 at 19:46

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 ...
Alyss asked 18/4, 2018 at 13:47

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...
Mannerless asked 24/5, 2013 at 19:57

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?
Jessamine asked 21/11, 2014 at 0:25

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...
Bonds asked 23/6, 2021 at 12:35

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...
Ungulate asked 23/3, 2012 at 12:38

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 ...
Breadthways asked 25/2, 2015 at 20:58

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...
Aphis asked 8/4, 2016 at 14:25

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 ...
Harmattan asked 5/7, 2020 at 15:54

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...
Dewy asked 13/6, 2020 at 17:21

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...
Dysplasia asked 28/5, 2020 at 7:10

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...
Colitis asked 12/8, 2012 at 12:31

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...
Ylangylang asked 16/1, 2012 at 17:6

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) ...
Qualified asked 12/9, 2019 at 16:12

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...
Revivify asked 3/9, 2019 at 4:48

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...
File asked 7/10, 2013 at 21:53

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...
Quach asked 23/6, 2019 at 22:3

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?
Demmer asked 27/6, 2017 at 11:5

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...
Imf asked 3/11, 2013 at 19:2

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...
Fantom asked 4/7, 2012 at 8:52

© 2022 - 2024 — McMap. All rights reserved.