similar to: setAs between a new S4 class and "POSIXlt"

Displaying 20 results from an estimated 8000 matches similar to: "setAs between a new S4 class and "POSIXlt""

2005 Mar 29
0
setAs between a new S4 class and "POSIXlt"
Dear R core team Please apologize for posting the same question twice on R-help and R-devel. Since I was not sure which list is appropriate I tried R-help (Tue Mar 22), but got no answer. Now I do not know if the formulation of my question was unclear or the question is not so easy to answer or to easy (what I do not hope). My problem: I create a new S4 class, containing one slot, data (of
2011 Mar 08
1
Date arithmetic coerces POSIXlt to POSIXct?
Hi. This feels like a bug to me, or at least an undocumented feature, but I thought I'd see what people here thought of it. Consider a POSIXlt object like this one: > a <- as.POSIXlt ("2011-01-23 12:45:45") > class (a) [1] "POSIXlt" "POSIXt" Fine. Now, if I do some arithmetic on that object, the result is converted to POSIXct. > class (a
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]
2020 Oct 06
0
S4 - inheritance changed by order of setClassUnion and setAs()
Andreas, As far as I can tell (/conjecture), this is because the list of classes a particular class inherits from directly is appended to as needed, and so the order that a class extends others isd refined by the order that those connections are defined. We can see this with two setClassUnion calls, rather than required setAs: > setClass("grandma", slots = c(a =
2012 Jun 15
2
POSIXlt and trunc
Hi, I'm having trouble understanding how trunc is operating on vectors of POSIXlt objects. Why does dates[1:4] in the last line return a bunch of NAs even though dates look like it has all the right elements? This worries me that something is off with my use of trunc. Is trunc not suppose to be vectorized with POSIXlt? If not, then how should I truncate a bunch of POSIXlt objects? I'm
2004 Oct 08
0
user interface and documentation of setIs and setAs, some suggestions (S4).
By reading the documentation for _setIs_ I noted that for the same object three different names are used. 1) the name of the first argument in the functions coerce and replace in setIs must be _obj_ (see example section or) setIs("MVCa","list",coerce=function(obj){obj@list},replace=function(obj,value){obj@list<-value}) 2) At the same time in the usage section:
2008 Feb 17
1
How to make a vector/list/array of POSIXlt object?
Hi Guys, I'm cooking up my time series code. I want a data frame with first column as timestamp in POSIXlt format. I hit on this the problem of how to create an array/list/vector of POSIXlt objects. Code is as follows > dtt=array(dim = 2) > t=as.POSIXlt( strptime("07/12/07 13:20:01", "%m/%d/%Y %H:%M:%S",tz="GMT")) > dtt [1] NA NA > t [1]
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"
2009 Aug 05
1
S4 method dispatch: coercion of arguments with setAs defined
Hi list, I've got a class B that contains a slot obj of class A. I'd like to be able to call all the methods of class A directly on objects of class B as if I had called the method on slot obj. This without overloading all methods of class A to work on class B. I don't define B as an extension of A, because I want class B to also work with objects of classes that inherit from
2012 Feb 24
6
strange behaviour of "POSIXlt" "POSIXt" object
Hi, Does anybody know why get I this kind of strange situation: Browse[2]> hcEnd [1] "2009-03-29 06:30:00" Browse[2]> class(hcEnd) [1] "POSIXlt" "POSIXt" Browse[2]> is.na(hcEnd) [1] TRUE This issue is the source of my all issues in my program, Thanks for your help -- View this message in context:
2003 Jun 12
0
Re: (PR#3241) write.table() fails for POSIXlt class and NAs in
Uwe, You said you used testdata <- data.frame(date = strptime(c("31121991", "31121991"), "%d%m%Y"), nothing = c(NA, NA)) but that's not the same object, and that one does work for me. > dput(testdata) structure(list(date = structure(c(694137600, 694137600), class = c("POSIXt", "POSIXct")), nothing = c(NA, NA)),
2020 Oct 23
0
The presence/absence of `zone` in POSIXlt depending on time zone as a cause of possible inconsistences?
?Hi again, I take advantage of my previous mail to ask you a question for which I was looking for an answer when detected the behaviour I previously told. In the help of DataTimeClasses one can read: "POSIXlt" objects will often have an attribute "tzone", a character vector of length 3 giving the time zone name from the TZ environment variable and the names of the base time
2020 Oct 05
2
S4 - inheritance changed by order of setClassUnion and setAs()
Dear colleagues, there is a behaviour with S4 (virtual) classes that I find very hard to understand: Depending on the position of setAs(), the tree of inheritance changes. This is my baseline example that defines the classes "grandma", "mother", "daughter" and a virtual class "mr_x". For a new instance if "daughter", "mr_x" is betweeen
2005 Jul 11
0
Sys.timzone() returns NA - problem caused by as.POSIXlt? (PR#8003)
This is not a bug in R: the documentation does say the result is OS-specific. `GMT' is a not a proper timezone on Windows, so NA is a valid answer. (Windows seems to use GMT to refer to the timezone of the UK, e.g. > Sys.time() [1] "2005-07-11 07:49:56 GMT Daylight Time" > Sys.timezone() [1] "GMT Daylight Time" although I am in British Summer Time not GMT.)
2011 Feb 18
1
problem with rbind when data frame contains an date-time variable "POSIXt" "POSIXlt"
I'm trying to rbind two data frames, both with the same columns names. One of the columns is a variable with date-time and this variable is causing the rbind to fail--giving the error "Error in names(value[[jj]])[ri] <- nm : 'names' attribute [7568] must be the same length as the vector [9]" Is there a way to stack or rbind these two data frames even with this extended
2010 Oct 28
1
Unexpected behabiour of min, tapply and POSIXct/POSIXlt classes?
Hello, I found rather surprising the behaviour of POSIXct and POSIXlt classes when combined with min and tapply. The details can be deduced from the script below: ############# Start of the script #################### before <- Sys.time() Sys.sleep( 1 ) now1 <- now2 <- Sys.time() my.times <- c( before, now1, now2 ) class( my.times ) ## [1] "POSIXct"
2008 Apr 23
1
S4 default for coercing
Something has changed in the S4 default for coercing. Am I now suppose to use setAs, or is there something else I should do to make this work: R version 2.7.0 (2008-04-22) .... > require("methods") > setClassUnion("OptionalPOSIXct", c("POSIXct", "NULL")) [1] "OptionalPOSIXct" > setClass("TSmetax",
2003 Jun 12
0
Re: write.table() fails for POSIXlt class and NAs in another variable (PR#3242)
Uwe Ligges wrote: > Consider the following data.frame: > > > testdata > date nothing > 1 1991-12-31 NA > 2 1991-12-31 NA > > where date is of class POSIXlt. For easy reproducibility: > > "testdata" <- structure(list(date = structure(list(sec = c(0, 0), > min = c(0, 0), hour = c(0, 0), mday = c(31, 31), mon = c(11, 11),
2008 Mar 17
1
setAs vs setIs
Hi the list I am fighting with the twins setAs and setIs... Here are some questions and comments (comments to myself but that migth be wrong, it is why I am posting them) 1. Very surprising : using setIs define 'is', 'as<-' but not 'as' ??? 2. Using setAs define 'as', 'as<-' but not 'is'... What surprise me is that as<- can be define by