Re: [Rd] inconsistency in POSIXlt

2015-12-08 Thread Lorenz, David
Gabriel, Thanks. I'm just frustrated by the inconsistencies in what I see in POSIXlt. I'm not even sure what the tzone attribute does. Here's an example that show behavior different from POSIXct. > tl <- as.POSIXlt("2001-04-05 12:00", tz="America/Chicago") > tl [1] "2001-04-05 12:00:00 CDT" > at

[Rd] inconsistency in POSIXlt

2015-12-07 Thread Lorenz, David
The documentation for the POSIXlt class states '"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 zone and the alternate (daylight-saving) time zone. Sometimes this may jus

Re: [Rd] Defining a `show` function breaks the print-ing of S4 object -- bug or expected?

2015-06-30 Thread Lorenz, David
There is something I'm really missing here. The function show is a standardGeneric function, so the correct way to write it as method like this: setMethod("show", "Person", function(object) { for an object of class "Person" for example. Dave On Tue, Jun 30, 2015 at 10:11 AM, wrote: > Same thi

Re: [Rd] we need an exists/get hybrid

2014-12-04 Thread Lorenz, David
All, So that suggests that .GlobalEnv[["X"]] is more efficient than get("X", pos=1L). What about .GlobalEnv[["X"]] <- value, compared to assign("X", value)? Dave On Wed, Dec 3, 2014 at 3:30 PM, Peter Haverty wrote: > Thanks Winston! I'm amazed that "[[" beats calling the .Internal > directly

Re: [Rd] Unexpected behavior of identical() with language objects

2014-10-29 Thread Lorenz, David
Fascinating! I tried the comparisons with all.equal(), expecting a description of the difference, but TRUE was returned in both cases. Dave On Wed, Oct 29, 2014 at 3:26 PM, Winston Chang wrote: > I ran into this and found the result very surprising: > > identical( quote({ a }), quote({ a }) )

Re: [Rd] How I() works in a formula

2014-10-03 Thread Lorenz, David
Joris, Basically, the I() function, as it is used in a regression model, allows the user to perform arithmetic operations on a variable that would otherwise be interpreted by the formula. It is not trapped as a special function as Error() is in aov(). There may be other applications where the c

Re: [Rd] Inconsistency in vector printing depending on length

2014-05-16 Thread Lorenz, David
Dominic, Actually it makes perfect sense. When R prints vectors of length less than 9, it does not ever need to print 2 digits for the index. For lengths between 10 and 99, it may need to print an index with 2 digits, therefore, it prints the first index and all single digit indexes with a leadin

Re: [Rd] seq range argument

2014-02-03 Thread Lorenz, David
Berry, It sounds like you just need a little helper function like this: ser <- function(x, len=100, f=0.1) { dr <- extendrange(x, f=f) return(seq(dr[1L], dr[2L], length.out=len)) } I called it ser, short for sequence extended range. Use it thusly: Ijustneed <- ser(D_orig) Hope this h

Re: [Rd] Matrix memory layout R vs. C

2013-12-06 Thread Lorenz, David
Larissa, So is the problem "in the matrix reference is mat[col][row] whereas in R it is mar[row, col]?" The solution is just recognizing the difference in references. Dave On Fri, Dec 6, 2013 at 7:21 AM, Larissa Hauer wrote: > > Hi everybody, > > I'm trying to pass a matrix from R to C, wher

Re: [Rd] appropriate work-around for problems with a specific plot device (Rstudio)?

2013-10-25 Thread Lorenz, David
Skye, I ran into a similar problem with RStudio. My solution was just to check if "windows" exists and if it does, open windows, then check "quartz" and so forth. You can restrict the exists function to look only in grDevices. Dave On Fri, Oct 25, 2013 at 4:19 AM, Milan Bouchet-Valat wrote: >

Re: [Rd] factor(x, exclude=y) if x is a factor

2012-12-06 Thread Lorenz, David
Suharto, I think that the key is to read the definition of exclude in the Arguments section: a vector of values to be excluded when forming the set of levels. This should be of the same type as x, and will be coerced if necessary. Because the levels already exist for x as a factor, they are n