similar to: potential setClass bug (with user-defined environment)

Displaying 20 results from an estimated 400 matches similar to: "potential setClass bug (with user-defined environment)"

2006 Sep 23
1
generics for primitive functions
i think these two code snippets exhibit a bug. they are identical but for the inclusion of an initial line in snippet [2] [1] setMethod("Math", signature(x = "numeric"), function(x) "Works") getGeneric("sqrt")(4) [2] getGeneric("sqrt")(4) setMethod("Math", signature(x = "numeric"), function(x) "Works")
2006 Oct 11
1
dispatching on group generics with more than one formal
please see the code below. foo2 fails to dispatch correctly, but foo does fine. i have tried 'cacheMetaData(1)' and a number of different variants of 'cacheGenericsMetaData', on the possibility there is a caching issue. but i still can't sort it out. also one general question: does it really matter what's in the body of the function definition in a
2006 Oct 06
1
class unions?
the code below has me confused: setClassUnion("index", c("numeric", "character", "logical")) extends("numeric") # i don't see the class union library(Matrix) extends("numeric") # now i see the class union i am aware that the "Matrix" package separately defines the "index" class union. is it the case that
2006 Sep 20
1
residual '*tmp*' variable after "[<-" error
self-sanity check prior to filing a bug report: attempted replacement that generates an error leaves a '*tmp*' variable in the global environment. test <- 1:10 test[2:4] <- expression(e) ls() i've read section 3.4.4 of the "R Language Definition" which discusses the mechanism for replacement, and it is not clear to me whether this was intended, but i suspect
2005 Dec 29
1
trouble with S4 methods for group "Summary"
Hello. This question concerns the Methods package. I have created a new class and am trying to set a method for it for S4 group generic "Summary". I have run into some signature problems. An example: > setClass("track", representation(x="numeric", y="character")) [1] "track" > setGeneric("max", group="Summary")
2005 Feb 01
1
Error in load(dataFile, myEnv)
Dear all, I just found that some of the packages are not able to load any more, after I installed R2.0.1 in my Mac, it even affects my old R1.8 installs. It gives me errors when I load packages that contains "myEnv" settings. such as: RMySQL, DBI, Rggobi, etc. But others that does not require "myENV" is all right, like tcltk that only calls the c functions. The errors
2011 Jul 25
1
do.call in "with" construction
Dear all, I'd appreciate any help to rectify what must be a misconception of mine how environments work: ########################## myEnv <- new.env() myEnv$a.env <- 1 myEnv$symbols.env <- "a.env" a.global <- 2 symbols.global <- "a.global" myFun <- function(symbols){do.call("print", lapply(symbols, FUN=as.name))} do.call("myFun",
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
2020 May 12
4
S3 method dispatch for methods in local environments
Dear All, In R 3.6.3 (and earlier), method dispatch used to work for methods stored in local environments that are attached to the search path. For example: myfun <- function(y) { out <- list(y=y) class(out) <- "myclass" return(out) } print.myclass <- function(x, ...) print(formatC(x$y, format="f", digits=5)) myfun(1:4) # prints: [1]
2010 Oct 20
2
new.env does not recognize parents from subclasses of "environment"
Dear Developers, A lot has been changed in the R12.0 with respect to behavior of "environment" subclasses. Many thanks for that. One small irregularity, though; new.env does not allow the parent to be from S4 subclass. > setClass("myenv", contains="environment") [1] "myenv" > new.env(parent=new("myenv")) Error in new.env(parent =
2008 Jan 28
1
package.skeleton from within function: objects not found
Hi all, I ran into a strange error: I am trying to create a package skeleton for a new source package from within a function. Objects that are created in this function are to be included in my package, but for some reason, I get an error message saying that these objects cannot be found. Here is the code: ###### myfun <- function(pkgName,x){ myenv <- new.env() apply(x, 1,
2006 Dec 18
2
write() gotcha
Hi I used write() the other day to save some results. It seems that write() does not record the full precision of the objects being written: > write(pi,file="~/f",ncolumns=1) > pi.saved <- scan("~/f") Read 1 item > dput(pi) 3.14159265358979 > dput(pi.saved) 3.141593 > pi-pi.saved [1] -3.464102e-07 > This difficulty was particularly difficult to
2007 Mar 19
1
Again...
Newbie trying to install wine in his Mac OSX, getting the old annoying message, home:~/Desktop/wine G3$ /Users/G3/Desktop/wine/tools/wineinstall WINE Installer v0.75 Running configure... configure: creating cache config.cache checking build system type... powerpc-apple-darwin8.7.0 checking host system type... powerpc-apple-darwin8.7.0 checking whether make sets $(MAKE)... no checking for gcc...
2006 Jul 11
1
invalid alignment error in R-2.4.0
Hi I thought I'd pass one of my package through R CMD check with R-2.4.0 with the following result (it's clean under R-2.3.1): [snip] > > # histogram of the fourth power: > hist(out^4, col="gray") *** caught bus error *** address 0x12, cause 'invalid alignment' Traceback: 1: sort(x, partial = c(half, half + 1)) 2: sum(sort(x, partial = c(half, half +
2005 Oct 12
1
bug checking
I have observed the following behavior, wondering if it is a bug before I submit a report. I am using the plot function with call: plot(X, Y, col="red", . . . ) where X is an object that inherits from classes 'dates' and 'times' (created with the 'dates' function from package 'chron') and y is a numeric vector. The color red is applied to the
2006 Oct 20
1
understanding virtual classes and extensions thereof
I am having some trouble creating a hierarchy of virtual classes (akin to the class structure in the 'Matrix' package). I think they arise from my not understanding the best way to specify virtual subclasses of a virtual class. please see questions below code. setClass("mom") setClass("kid1", representation("mom", "VIRTUAL"))
2006 Sep 14
1
attributes of S4 objects
I am having a bit of a struggle deciding when to use attributes with S4 objects. Clearly the 'class' attribute will always be present. But it is not clear to me whether the architects of the methods package intend that other attributes, such as 'names', will still be used when the S4 implementation is complete. I notice that, when you create a formal object from an
2006 Oct 19
1
default arguments in generics and methods
i believe the following is true but would appreciate confirmation that it is intended behavior and will continue: if a default argument is employed in the definition of a generic function, and the generic is called with the argument in question (call it 'ARG') missing, then the method for signature (..., ARG = "missing", ...) will be called by 'standardGeneric'
2006 Sep 21
1
validity testing as part of '@<-'
'methods' package feature request / discussion starter: perhaps a call to 'validObject' should occur at part of any slot replacement operation (and the operation not be carried out if it would invalidate the object)? this may prevent the need for prophylactic 'validObject' calls in other user-defined functions. in the example below, the slot assignment occurs
2011 Jun 16
7
Problem with usage of arrays
Hi there, i can''t use array in puppet. Here is my codesnipplet: $callapidata = [ ''wert1'',''wert2''] notice $callapidata[1] A puppetrun results in: Could not retrieve catalog from remote server: Error 400 on SERVER: can''t convert String into Integer at /etc/puppet/myenv/modules/ uc4client/manifests/init.pp:41 on node testnode Thanks for your