similar to: any updates w.r.t. lapply, sapply, apply retaining classes

Displaying 20 results from an estimated 11000 matches similar to: "any updates w.r.t. lapply, sapply, apply retaining classes"

2009 Sep 25
1
Collision between difftime and ggplot2.
It seems that there are several folks Out There with an itch to scratch with respect to difftimes. http://article.gmane.org/gmane.comp.lang.r.devel/19223/match=difftime http://article.gmane.org/gmane.comp.lang.r.devel/18441/match=difftime http://article.gmane.org/gmane.comp.lang.r.devel/10882/match=difftime http://article.gmane.org/gmane.comp.lang.r.devel/11675/match=difftime and I might be
2009 Feb 06
1
Operations on difftime (abs, /, c)
Since both comparison and negation are well-defined for time differences, I wonder why abs and division are not defined for class difftime. This behavior is clearly documented on the man page: "limited arithmetic is available on 'difftime' objects"; but why? Both are natural, semantically sound, and useful operations and I see no obvious reason that they should give an error:
2009 Feb 06
1
Operations on difftime (abs, /, c)
Since both comparison and negation are well-defined for time differences, I wonder why abs and division are not defined for class difftime. This behavior is clearly documented on the man page: "limited arithmetic is available on 'difftime' objects"; but why? Both are natural, semantically sound, and useful operations and I see no obvious reason that they should give an error:
2006 Apr 03
1
weird "max" behavior for difftime class
If you apply the "max" function to a vector of class "difftime" with units="days", the returned value is in units of "seconds". Is this not a bug? At any rate it can lead to confusing results if one buries a call to "max" deep in some data analysis code. Details: > y<-structure(1, class = "difftime", units = "days")
2018 Aug 01
1
RFC: make as.difftime more consistent or convenient
Hello! you, Emil Bode <emil.bode at dans.knaw.nl>, wrote on Tuesday, July 31, 2018 1:55 PM: > Some of the changes you're proposing could be made (with effort), but note that you're not > restricted to providing strings with a format. > What you're trying to do can be accomplished with as.difftime(12, units='weeks'), see also > ?as.difftime > > Or if
2013 Jul 09
1
Is difftime a "class"
I am trying to write S4 methods with "difftime" in the signature but am being "informed" (? not a warning or error) that "difftime" is not a class. Nevertheless, dispatch takes place. Should I simply ignore that "information"? Here is a toy example: > setClass("foo", contains = "Date") > setMethod("+", c("foo",
2011 Oct 25
2
difftime producing NA values in R 2.12.2
R-listers, I have noticed several posts on issues with difftime producing NA's but they have been for older versions of R. Here's the issue associated with difftime that I am dealing with in R 2.12.2. > preciptime = strptime("01/10/2007 14:00",format="%m/%d/%Y %H:%M") > class(preciptime) [1] "POSIXlt" "POSIXt" > # Now using difftime, this
2010 Jun 22
1
New errors with difftime()-objects in 2.11.1 (was Re: Request: difftime method for cut())
On Thu, Jun 10, 2010 at 3:39 PM, Gustaf Rydevik <gustaf.rydevik at gmail.com> wrote: > Hi all, > > The recent change in 2.11 that made as.numeric() return false on > difftime-objects broke some of my code that calculated age classes of > individuals using cut(). While this was no big thing to fix for me, it > might be wise > to provide a cut.difftime method to ?stop
2010 Jun 22
1
New errors with difftime()-objects in 2.11.1 (was Re: Request: difftime method for cut())
On Thu, Jun 10, 2010 at 3:39 PM, Gustaf Rydevik <gustaf.rydevik at gmail.com> wrote: > Hi all, > > The recent change in 2.11 that made as.numeric() return false on > difftime-objects broke some of my code that calculated age classes of > individuals using cut(). While this was no big thing to fix for me, it > might be wise > to provide a cut.difftime method to ?stop
2010 Apr 05
1
using difftime()
I'm new to R and have the following problem with difftime: if I directly assign date/time strings in difftime I get the expected result: > a<-"2010-03-23 10:52:00" > a [1] "2010-03-23 10:52:00" > b<-"2010-03-23 11:53:00" > u2<-as.difftime(c(a,b), format ="%Y-%m-%d %H:%M:%S", units="mins") > u2 Time differences in mins
2002 Dec 04
2
difftime arithmetic (PR#2345)
Full_Name: Barry Rowlingson Version: 1.6.0 OS: RH8 i386 Submission from: (NULL) (148.88.136.205) Strange things happen if I premultiply a difftime() object with a number. Example: > d1 <- difftime(Sys.time(),Sys.time()) > d2 <- 1 * difftime(Sys.time(),Sys.time()) > d3 <- difftime(Sys.time(),Sys.time()) * 1 > d1 Time difference of 0 secs - thats fine > d2 [1] 0
2008 Nov 07
2
Unexpected behavior of clocktime related to daylight savings time
Colleagues, I submitted this several days ago and no one responded, so I am trying again, trying a different subject line: I just encountered some unexpected behavior of difftime in relationship to the change from daylight savings to standard time. My understanding is that DST and ST take effect at 2AM. However, the results below suggests that R (version 2.8.0 in OS X) implements the
2007 Feb 21
1
Adding difftime objects to POSIXt objects
Hello, ?DateTimeClasses states that "one can add or subtract a number of seconds or a 'difftime' object from a date-time object, but not add two date-time objects." So, is the below expected behavior? > x <- Sys.time() > x [1] "2007-02-21 16:19:56 CST" > x + as.difftime("1","%H") [1] "2007-02-21 16:19:57 CST" Warning
2008 May 14
1
Time differences (as.difftime?) issue
Dear all, I have a vector generated using the function strptime: > my.dt [1] "2004-04-19 08:35:00 W. Europe Daylight Time" "2004-04-19 09:35:00 W. Europe Daylight Time" "2004-04-19 11:35:00 W. Europe Daylight Time" [4] "2004-04-19 13:35:00 W. Europe Daylight Time" "2004-04-20 07:50:00 W. Europe Daylight Time" > class(my.dt) [1]
2007 Oct 08
2
Incompatible methods ("-.POSIXt", "Ops.difftime") for "-"
Dear all, according to the Help-page of DateTimeClasses {base} I should be able to do time - z with time date-time objects z a numeric vector (in seconds) or an object of class "difftime". However, on R version 2.6.0 (Windows XP) I get > Sys.time() - as.difftime(c("0:3:20", "11:23:15")) Time differences in mins [1] 1191837998 1191837318
2011 Sep 19
2
fechas ??
Hola a todos: Tengo un problema con las fechas, básicamente necesito una diferencia en días y siempre se sale en segundos. Salvo un ejemplo copiado de un libro, pero yo necesito procesar los datos propios. Les paso el código en R (copiar y pegar, son solo dos días que se comparan) y al final como me salen los resultados porque es medio complicada mi redacción. ¿Alguna idea? fechas1
2012 Mar 19
1
diff(time) vs. difftime?
I just encountered another RTFM problem: With diff(as.POSIXct(...), ...) I was unable to control the units of the results. Examples: > (d.d <- diff(as.POSIXct(c('2012-12-12', '2012-12-13')))) Time difference of 1 days > (d.h <- diff(as.POSIXct(c('2012-12-12 08:00', '2012-12-12 09:00')))) Time difference of 1 hours > (d.m <-
2006 Feb 21
3
Number of Days Between Dates: Incorrect Results For Date Calucations.
In some cases, incorrect results are produced by the code below intended to calculate the number of days between 2 dates. The year in question was a leap year. Note the results for 2004-04-04 and 2004-04-05 are the same! They should be 37 and 38 respectively. > as.integer(as.POSIXct("2004-04-02") - as.POSIXct("2004-02-27")) [1] 35 >
2009 Mar 17
1
Mean of difftime vectors : "code infelicity" or intended behaviour ?
Dear list, "+" (and "-") being defined for difftime class, I expected mean() to return something sensible. This is only half-true : > mean(c(1:5, 5:1),na.rm=TRUE) [1] 3 > mean(as.difftime(c(1:5, 5:1),unit="mins"),na.rm=TRUE) Time difference of 3 mins Fine so far. However : > mean(c(1:5, NA,5:1),na.rm=TRUE) [1] 3 > mean(as.difftime(c(1:5,
2005 Nov 23
3
date/time arithmetic
On the help page "DateTimeClasses {base}" it says: "One can add or subtract a number of seconds or a difftime object from a date-time object, but not add two date-time objects." However, > x<-Sys.time(); y<-Sys.time()+3600 > diff<-y-x > x; y; diff [1] "2005-11-23 19:58:20 GMT" [1] "2005-11-23 20:58:20 GMT" Time difference of 1 hours