similar to: puzzled by math on date-time objects

Displaying 20 results from an estimated 10000 matches similar to: "puzzled by math on date-time objects"

2009 Jul 23
2
alternative to rbind within a loop
Hi, I often have to do this: select a folder (directory) containing a few hundred data files in csv format (up to 1000 files, in fact) open each file, transform some character variables in date-tiime format make into a dataframe (involves getting rid of a few variables I don't need concatenate to the master dataframe that will eventually contain the data from all the files in the
2007 Oct 27
1
having problems re-ordering a dataframe
Dear R users, I need to reorder a dataframe using 3 variables for the determine the sorting order. When I create a simple dataframe to test the method, things work as I expected: a1 <- rep(1:10, each=8) a2 <- rep(rep(1:2, each=4), 10) a3 <- rep(c(1:4),20) (a <- data.frame(a1, a2, a3)) for each combination of a1 and a2, a3 is increasing t <- order(a$a1, a$a2, rev(a$a3)) b
2006 Jul 23
1
diff, POSIXct, POSIXlt, POSIXt
Dear Listers, I have encountered a strange problem using diff() and POSIXt: dts<-c("15/4/2003","15/7/2003","15/10/2003","15/04/2004","15/07/2004","15/10/2004","15/4/2005","15/07/2005","15/10/2005","15/4/2006") dts <- strptime(dts, "%d/%m/%Y") class(dts) [1] "POSIXt"
2006 Jul 23
1
diff, POSIXct, POSIXlt, POSIXt
Dear Listers, I have encountered a strange problem using diff() and POSIXt: dts<-c("15/4/2003","15/7/2003","15/10/2003","15/04/2004","15/07/2004","15/10/2004","15/4/2005","15/07/2005","15/10/2005","15/4/2006") dts <- strptime(dts, "%d/%m/%Y") class(dts) [1] "POSIXt"
2011 Jun 05
1
unwanted switch to DST with POSIXct objects
Hi, For a project I try to keep everything in normal time, not daylight saving time, to prevent problem when instruments collected data during the nights when we go from DST to normal time. But sometimes R tricks me and I do not know how to prevent it. This is one example: lights_on = as.POSIXct(c("2011-05-06 04:09:26", "2011-05-07 04:07:53", "2011-05-08
2011 Aug 14
2
Trouble: Time Difference with difftime
Hello all!!! I want to measure the duration of events (given a start and an end time). The catch is that I require the output in calender days. This means: 02-Jan-2011 00:01:00 minus 01-Jan-2011 23:59:00 should be 1 day (although the real time difference is only 2 minutes) My data is the following head(episode.ct) [1] "2009-07-13 13:37:20 CEST" "2009-07-14 07:29:20 CEST"
2020 Oct 01
3
timezone tests and R-devel
The return value of Sys.time() today with a timezone of US/Eastern is unchanged between 4.0.3-patched and devel, but on devel the following test fails all.equal(x, as.POSIXlt(x)) with x = Sys.time() This means that devel does not complete make tests (failure on tests/reg-tests-2.R) It is entirely possible that it is an error on my end, I use export TZ="US/Eastern" but I have been
2011 Oct 19
1
Square ended segments
Good Afternoon R Community, I am working on plotting behavior codes over short durations of time (a few seconds at a time over 1-2 hrs). I am utilizing as.POSIXct to store the time. I wanted to make a quasi time line using these time. I utilized the segments function to represent these times. However the segments rounds off at the ends and does not have the crisp look I need for my purposes.
2018 Apr 22
3
Gantt Chart Using Plotrix
Hi Sarah Thank you very much for your pointers. Is there a way to specify the date string as POSIXct when reading in? I have tried the following (very inelegant way) and still have no luck. --- Begin Code --- # 1st read in the spreadsheet with stringsAsFactors set to FALSE > abc <- read.csv("gntr1.csv", header=TRUE, stringsAsFactors=FALSE) > abc code tasks.labels
2009 Apr 20
1
bladder1 dataset in survival library
Hello, In package survival should be a dataset bladder1. http://stat.ethz.ch/R-manual/R-devel/library/survival/html/bladder.html I can not open it (not found). Both bladder and bladder2 are there. Thanks, Petra
2003 Jan 03
4
as.POSIXct problem?
Under platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major 1 minor 6.1 year 2002 month 11 day 01 language R > x <- strptime(c('10/10/1969','12/31/2002'),format='%m/%d/%Y')
2020 Oct 02
2
timezone tests and R-devel
Yes, the potential issue I see is that make check fails when I explicitly set TZ. However, I set it to be the same as what the system reports when I login. Details: The system (RHEL) I am working on has $ strings /etc/localtime | tail -n 1 EST5EDT,M3.2.0,M11.1.0 $ date +%Z EDT $ echo $TZ US/Eastern On Fri, Oct 2, 2020 at 9:48 AM Sebastian Meyer <seb.meyer at fau.de> wrote: > Thank
2009 Mar 31
2
error message obtained when plotting survival curves (error not previously obtained)
Hello, I now receive an error message when obtaining a survival plot, which was not previously received with the same code. I recently updated all my packages. It does not seem to be a peculiarity of my data as I receive the error using data available in R. A plot is produced but I am uncertain regarding the error message. > library(surv2sample) > data(gastric) > fit <-
2018 Apr 23
0
Gantt Chart Using Plotrix
Hi, Your attempt didn't work because you didn't do what I suggested, which was make sure that your data frame matched the example given in the help for gantt.chart. Here's what you have: > str(cdfg) 'data.frame': 3 obs. of 3 variables: $ c1d1: Factor w/ 3 levels "task 1","task 3",..: 1 3 2 $ c2d1: POSIXct, format: "2018-04-01"
2007 Aug 08
2
Error: Cannot Coerce POSIXt to POSIXct when building package
A newbie here - please forgive me if this is a basic question. We have an in house package built in R 2.2.1 (yes we're a little behind the times at our firm)and would like to rebuild it using R 2.5.1. However, when I try and build the package from source, I keep getting this error: Error in as(slotVal, slotClass, strict = FALSE) : no method or default for coercing "POSIXt"
2001 Sep 25
1
blues in c
G'Day, I'm a little confused why the c function has the followng effect on classes - is this a feature ? My workround [ class(cc) <- c("POSIXt", "POSIXct") ] seems to do the job. Many thanks Bernie McConnell "R version 1.3.1, 2001-08-31" on NT > aa <- as.POSIXct("2001-09-23") > bb <- as.POSIXct("2001-09-24") > cc
2007 Oct 25
1
Strange behavior with time-series x-axis
I recently called plot(x,y) where x was an array of POSIXct timestamps, and was pleasantly surprised that it produced a nice plot right out of the box: z <- as.POSIXct(c("2006-10-26 08:00:00 EDT","2007-10-25 12:00:00 EDT")) x <- seq(z[1],z[2],len=100) y <- 1:100 plot(x,y,type="l") The X axis had nice labels, one tick mark every other month. (Plotting on
2004 Oct 05
2
correct my method of estimating mean of two POSIXlt data frames
Hello, I searched the archives but could not come to a solution. I have to two columns of information t_start_cdt looks like: > t_start_cdt[1:4] [1] "2003-07-09 11:02:25" "2003-07-09 11:10:25" "2003-07-09 11:30:25" [4] "2003-07-09 12:00:25" > class(t_start_cdt) [1] "POSIXt" "POSIXlt" t_end_cdt looks like: > t_end_cdt[1:4]
2018 Apr 22
0
Gantt Chart Using Plotrix
Hi, The help file for gantt.chart states that dates must be in POSIXct format, and the example shows how to do that. There's no reason that I can see that you can't use a data frame as input to gantt.chart, but you need to be very careful that your data frame matches the correct format. I bet also that your character fields were imported as factors, because you didn't specify not to.
2002 Jul 02
1
POSIX formats have problems with NA (PR#1732)
# pure replication code at end > # These work > > Sys.time() + NA [1] NA > as.POSIXlt(Sys.time(), "GMT") + NA [1] NA > > class(Sys.time() + NA) [1] "POSIXt" "POSIXct" > class(as.POSIXlt(Sys.time(), "GMT") + NA) [1] "POSIXt" "POSIXct" > > x <- Sys.time() + NA > y <- as.POSIXlt(Sys.time(),