Displaying 20 results from an estimated 2000 matches similar to: "Rprof and setMethod conflict?"
2009 Mar 03
1
profiler and loops
Hello,
(This is follow up from this thread:
http://www.nabble.com/execution-time-of-.packages-td22304833.html but
with a different focus)
I am often confused by the result of the profiler, when a loop is
involved. Consider these two scripts:
script1:
Rprof( )
x <- numeric( )
for( i in 1:10000){
x <- c( x, rnorm(10) )
}
Rprof( NULL )
print( summaryRprof( ) )
script2:
2020 Feb 26
1
Profiling: attributing costs to place of invocation (instead of place of evaluation)?
Hi
Consider the following example:
f <- function(expr) g(expr)
g <- function(expr) {
? h(expr)
}
h <- function(expr) {
? expr # evaluation happens here
? i(expr)
}
i <- function(expr) {
? expr # already evaluated, no costs here
? invisible()
}
rprof <- tempfile()
Rprof(rprof)
f(replicate(1e2, sample.int(1e4)))
Rprof(NULL)
cat(readLines(rprof), sep = "\n")
#>
2003 Mar 26
0
Rprof/UseMethod
I'm having difficulty with Rprof. I have a documentation example test.qss that
runs fine without profiling, but under Rprof,
> Rprof()
> source("test.qss")
Error in standardGeneric("model.matrix") :
UseMethod used in an inappropriate fashion
Luke wrote about a similar circumstance last summer:
# From: Luke Tierney (luke@stat.umn.edu)
# Date: Fri Jul
2004 Jun 28
2
Problem with hasArg and the ... argument (PR#7027)
Full_Name: Jelle Goeman
Version: 1.9.0
OS: mingw32, windows 2000
Submission from: (NULL) (145.88.209.33)
Hi Everyone,
I get very strange results using the function hasArg with the ... function
argument. In my own function:
> gt <- globaltest(X,Y)
> sampling(gt)
works fine, but
> sampling(globaltest(X,Y))
results in:
Error in eval(expr, envir, enclos) : "missing"
2002 Aug 26
1
Rprof and setMethod conflict (PR#1949)
Full_Name: Kevin C. Bartz
Version: 1.5.1
OS: Solaris 2.6
Submission from: (NULL) (192.223.226.5)
A while ago, I noticed this oddity about R profiling and setMethod.
First, I "test out" Rprof.
> require(methods)
Loading required package: methods
[1] TRUE
>
> Rprof("test.out")
> data.frame("a")
X.a.
1 a
> Rprof(NULL)
So far, so good. Next, I
2016 Jun 04
1
RProfmem output format
I'm picking up this 5-year old thread.
1. About the four memory allocations without a stacktrace
I think the four memory allocations without a stacktrace reported by Rprofmem():
> Rprofmem(); x <- raw(2000); Rprofmem("")
> cat(readLines("Rprofmem.out", n=5, warn=FALSE), sep="\n")
192 :360 :360 :1064 :2040 :"raw"
are due to some
2002 Aug 06
2
[ and setMethod conflict?
I noticed this oddity about [ and setMethod.
First, I define testFunc, which sorts a data frame by the first column and
returns the entries that aren't NAs, and testIt, which runs testFunc
repeatedly on a random large data frame, each time saving the return into a
dummy placeholder (for demonstration's sake).
> require(methods)
Loading required package: methods
[1] TRUE
> testFunc
2002 Aug 06
2
[ and setMethod conflict?
I noticed this oddity about [ and setMethod.
First, I define testFunc, which sorts a data frame by the first column and
returns the entries that aren't NAs, and testIt, which runs testFunc
repeatedly on a random large data frame, each time saving the return into a
dummy placeholder (for demonstration's sake).
> require(methods)
Loading required package: methods
[1] TRUE
> testFunc
1997 Aug 05
1
R-beta: Characters in .C
I am having some difficulties using dynamically loaded
C functions on a Sparc 10 with R compiled
using cc (both R-0.49 and R-0.50). I get sporadic errors with the
error message:
Error: character variables must be duplicated in .C/.Fortran,
with C functions which pass character variables.
my C functions look like: anyfunc(char **filename, other variables )
This error message appears about 25%
1997 Aug 05
1
R-beta: Characters in .C
I am having some difficulties using dynamically loaded
C functions on a Sparc 10 with R compiled
using cc (both R-0.49 and R-0.50). I get sporadic errors with the
error message:
Error: character variables must be duplicated in .C/.Fortran,
with C functions which pass character variables.
my C functions look like: anyfunc(char **filename, other variables )
This error message appears about 25%
2002 Aug 07
0
FW: [R] [ and setMethod conflict?
John Chambers suggested that I forward this thread (first posted to r-help)
along to r-devel...
Thanks,
Kevin
-----Original Message-----
From: John Chambers [mailto:jmc@research.bell-labs.com]
Sent: Tuesday, August 06, 2002 6:31 PM
To: Bartz, Kevin
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] [ and setMethod conflict?
Definitely something funny going on, but perhaps a little less sweeping
1998 Jan 03
1
R-beta: NextMethod(.Generic) bug
I'm a day-old R newbie (but a war-weary S veteran), with couple of
first-day questions:
In R 0.61, this code fails.
Ops.test <- function(e1,e2)
{
e1 <- NextMethod(.Generic)
e1
}
x <- 4
class(x) <- "test"
y <- x < 3
The error message is "Error in NextMethod(.Generic) : negative length vectors
are not allowed.".
I assume it is a bug.
2011 Oct 22
1
setMethod "[" - extract by names within Slot
Hi R-helper!
I have problem with setMethods for "[". Here is example :
setClass("myClass", representation(ID.r = "numeric", ID.c = "character", DAT = "matrix"))
to.myClass <- function(ID.r, ID.c, DAT) {
out <- new("myClass", ID.r = ID.r, ID.c = ID.c, DAT = DAT)
return(out)
}
setMethod("[",
2008 Mar 20
1
setMethod for "["
Hi R-Help,
Please consider the following simple case: I have a class like
setClass("myClass",
representation(x="matrix", y="character"))
and I would like to use the method *"["* for a *myClass* objects (but
changing the default *drop* argument from TRUE to FALSE):
setMethod("[","myClass",
function(x,i,j,...,drop=FALSE)
2003 Dec 02
1
setMethod("min", "myclass", ...)
Hello,
I have defined a new class
> setClass("myclass", representation(min = "numeric", max = "numeric"))
and want to write accessor functions, so that for
> foo = new("myclass", min = 0, max = 1)
> min(foo) # prints 0
> max(foo) # prints 1
At first i created a generic function for "min"
> setGeneric("min",
2004 Jan 29
2
Object validation and formal classes
I'm using R 1.8.1 (Win32, Linux) and have some difficulties using
validation functions for S4 classes. The problem is if I specify a
validation function with setValidity("myclass", validate.myclass) object
validation is only performed when I create an instance using
new("myclass"), or when I explicitly call validObject(x) where x is of
class "myclass", of
2011 Aug 14
0
Improved version of Rprofmem
The Rprofmem facility is currently enabled only if the configuration
option --enable-memory-profiling is used. However, the overhead of
having it enabled is negligible when profiling is not actually being
done, and can easily be made even smaller. So I think it ought to be
enabled all the time.
I've attached a patch doing this, which also makes a number of other
improvements to Rprofmem,
2006 Sep 22
1
setMethod
Hello R-help:
I was hoping someone could help me understand a particular function i came
across in a package:
"$.myClass" <- function( x, name ) {
sym = paste( "foo", name, sep = "_" )
if( is.loaded(sym) )
.Call(sym,x)
}
I understand the paste, and .Call part, but I'm not sure how this function
would get called? What exactly is
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
2003 Aug 21
2
efficiency and memory use of S4 data objects
I do lots of analyses on large microarray data sets so memory use and speed
and both important issues for me. I have been trying to estimate the
overheads associated with using formal S4 data objects instead of ordinary
lists for large data objects. In some simple experiments (using R 1.7.1 in
Windows 2000) with large but simple objects it seems that giving a data
object a formal class