Displaying 20 results from an estimated 20 matches for "chiefmurphi".
Did you mean:
chiefmurphy
2010 Jan 08
2
function by: order within subsets
When the 'by' function forms subsets, are the rows in the same order as they
are in the original data frame?
For example, I want to use 'by' to calculate cumulative sums of a value 'v'
by date 'd' for different levels of a factor 'f':
>
2012 Aug 15
1
Build from Source fails on Loading required package Matrix
Hello:
I am building R 2.15.1 from source on a Windows 7 machine with the x64
toolset, MixTeX, and InnoSetup per
http://cran.r-project.org/bin/windows/Rtools/. I obtained the source for
2.15.1 via svn from https://svn.r-project.org/R/branches/R-2-15-branch/.
This is my first try building R from source. The build seems to go far,
then terminates with "undefined exports: .M.classEnv" from
2010 May 06
1
Validity glitch when contains="matrix"
Sirs:
My validity function did not run when my class contains="matrix". But if I
first define the class with contains="numeric", then define it again
with contains="matrix", validity runs. Here's the session:
> f <- function(object) "BAD CLASS" # force error to
> setClass("A", contains="matrix", validity=f)
[1]
2010 Jul 02
3
Attributes of 1st argument in ...
R-Devel:
I am trying to get an attribute of the first argument in a call to a
function whose formal arguments consist of dots only and do something, e.g.,
call 'cbind', based on the attribute
f<- function(...) {get first attribute; maybe or maybe not call 'cbind'}
I thought of (ignoring "deparse.level" for the moment)
f<-function(...) {x <-
2009 Mar 16
4
Match .3 in a sequence
Hello:I am trying to match the value 0.3 in the sequence seq(.2,.3). I get
> 0.3 %in% seq(from=.2,to=.3)
[1] FALSE
Yet
> 0.3 %in% c(.2,.3)
[1] TRUE
For arbitrary sequences, this "invisible .3" has been problematic. What is
the best way to work around this?
Thank you.
Dan
[[alternative HTML version deleted]]
2010 Apr 19
0
S4-based package failure: setGeneric example#1
I am a newbie package builder who successfully built a "Hello world" package
but am now having trouble building a package with S4 functionality. I
thought I would start by building a package consisting of just the first
example under the setGeneric help page in a "fresh" 2.10.0 (windows) console
(methods loaded at startup). The example:
## create a new generic function, with a
2010 Apr 19
0
S4-based package failure: setGeneric example#1
Nevermind, I figured out my problem after looking at the packS4 package.
I didn't realize that package.skeleton would build invalid R code. The
warning hints at that, but I interpreted the warning to mean that the
package.skeleton-generated code should be *edited*, and none of my edits
gave me a workable package. Now I realize that the S4-driven code from
package.skeleton can simply be
2009 Nov 11
1
Help in 2.10 lost its "Find" feature
Sirs:
I understand that no one wanted to maintain the old Help, but one feature I
used extensively -- as a newbie to R or to an unfamiliar package -- was the
capability of searching for a word or phrase on the Help page itself.
Ctrl-F/Command-F (Windows/mac) 'differently-phrased-capability' was a fast
way to find out how to specify the arguments for a function call to
accommodate a
2010 Apr 30
1
S4 method execution time
Hello:
I have written some an elementary S4 classes around a matrix to strengthen
control of some key attributes. When I run a fairly elementary function
("f") on the matrix outside the class it runs instantaneously (elapsed
system.time = 0) but when I setMethod "f" on myClass -- returning an
instance of myClass -- it runs perceptibly slower (elapsed system.time =
.06). I
2010 Jun 09
0
Extract/format/show for S4 objects (Johann Hibschman)
Johann,
Following up on Gabor's reply, the mondate package (new on CRAN last week)
will accomplish your needs.
>I'm trying to make an integer-backed quarter (as in fraction of year)
>class, but I can't quite it to work. I want integer-backed so I don't
>have to worry about floating-point effects when doing math, and so that
>I can use it as in data.table.
mondate
2010 Jul 12
1
S4 class extends "data.frame", getDataPart sees "list"
R-Devel:
When I get the data part of an S4 class that contains="data.frame", it gives
me a list, even when the "data.frame" is the S4 version:
> d<-data.frame(x=1:3)
> isS4(d)
[1] FALSE # of course
> dS4<-new("data.frame",d)
> isS4(dS4)
[1] TRUE # ok
> class(dS4)
[1] "data.frame"
2011 Feb 21
0
[R] S4 classes: referencing slots with other slots
Dear Development Group,
In trying to answer the subject question myself, I found this thread
initiated by Tony from five years ago:
http://tolstoy.newcastle.edu.au/R/help/05/12/18169.html. I recently stumbled
upon the following S4 answer to Tony's question:
setClass("fooWfcn",
representation(dat1="vector",
dat2="vector",
2012 Jan 23
1
factor S4 class is NA when as.character method exists
Hello,
'factor' returns <NA> for my S4 object when the class is given an
"as.character" method. Here is a minimal example:
> setClass("foo", contains="numeric")
> bar <- new("foo", 12)
> factor(bar)
[1] 12
Levels: 12
> setMethod("as.character", "foo", function(x) paste("x=", x@.Data))
[1]
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",
2012 Nov 01
0
(no subject)
Dear Claudia:
Your question has many layers.
Technically speaking, when I do "2011-05-01 CEST" -"2011-04-01 CEST" I get:
> "2011-05-01 CEST" -"2011-04-01 CEST"
Error in "2011-05-01 CEST" - "2011-04-01 CEST" :
non-numeric argument to binary operator
As previous posters suggest, storing the date strings as Date objects
works
2010 Jul 20
1
Extract callNextMethod "array" calls "matrix"?
I have a class that extends array and my method for "[" stops with an error:
> setClass("A", contains="array")
[1] "A"
> setMethod("[", "A", function(x, i, j, ..., drop = TRUE) new("A",
callNextMethod()))
[1] "["
> a<-new("A",array(1:12,c(4,3,1)))
> a
An object of class "A"
, , 1
2010 Mar 13
2
dmvnorm masked by emdbook
I am using curve3d in the emdbook package to graph a gaussian copula density
function generated via the copula package. Unfortunately, it appears that
emdbook masks dmvnorm from the package mvtnorm in a way that prohibits
copula from generating the gaussian copula. (Sounds very confusing!) For
example,
> library(copula)
> f<-function(x,y) dcopula(normalCopula(0),c(x,y))
>
2010 Sep 03
1
Incorrect formatted output after subtracting non-integer seconds from POSIXt origin
> x<-as.POSIXct("1970-1-1", tz="UTC")-.5
> y<-as.POSIXct("1970-1-1", tz="UTC")+.5
> x==y
[1] FALSE # of course
but x and y "appear" to be the same when formatted, even with extra
precision:
> format(x, format="%Y-%m-%d %H:%M:%OS2")
[1] "1970-01-01 00:00:00.50"
> format(y, format="%Y-%m-%d
2010 May 17
1
format.data.frame containing S4 class with format method
Hi again,
I must be misunderstanding something fundamental about how an S4 class
stored in a data.frame can be persuaded to print according to a desired
format. The help page says:
format.data.frame formats the data frame column by column, applying the
appropriate method of format for each column.
Here is my class:
> setClass("A",contains="character")
[1] "A"
2010 Jun 23
2
format: different S4 behavior in a package
R-Devel-ers:
I have an S4 method that simply formats an object:
setGeneric("formatMe", function(x) standardGeneric("formatMe"))
setMethod("formatMe", "ANY", function(x) format(x))
If I issue the above in an R session, then define an S4 class with its own
format method, I get the desired result:
> setClass("A",contains="numeric")