Displaying 20 results from an estimated 6000 matches similar to: "'cat' and 'write' as generic, just like 'c', 'cbind' etc?"
2008 Mar 26
0
as.POSIXct/as.POSIXlt generics
Hi,
I am trying to define the as.POSIXct as an S4 method for one of my
classes. Trying to define a generic, I am getting an error that it is
already differently defined in base. However, if I query for it, there
is no definition. Being in base, I also cannot really import it. If I
define methods without definig a generic, they will work but with a
warning that a new generic will be automatically
2008 Apr 22
0
S3 method despatch (changed between 2.6.2 and 2.7.0 RC?)
Dear developers:
I have observed a change in the behaviour of S3 method despatch (as I
guess related to namespaces) between 2.6.2 and yesterday's 2.7.0 RC and
would be grateful if you could comment on that:
the 'Axis' function in the 'graphics' namespace calls
UseMethod("Axis",x), internally to despatch on the S3 Axis method
depending on the type of the argument.
2008 Apr 22
1
graphics::Axis loosing S3/S4 class attributes of 'x' in 2.7.0 RC
Following my previous post on S3 method despatch, I put debug messages
in the code of Axis, Axis.default and plot.default in graphics/R/axis.R
and graphics/R/plot.R to print the class of x, at and y on plot. After
recompiling R, what I see is that x *lost* its class attribute (at least
for classes not known to 'graphics') in Axis, called directly from
plot.default and this could be the
2009 Feb 11
1
setClassUnion with numeric; extending class union
Dear list:
I am looking for a good way to create an S4 class that would extend
numeric, but would allow NULL instead of data as well. As far as I can
see there is no way at the moment to do that, but please correct me if I
am wrong. The best solution I came up with so far was the following (it
also indicates a problem of using setClassUnion with numeric as one of
the classes):
I define a class
2009 Jan 13
2
particulars of importing/loading libraries
Dear List:
Sorry for posting maybe a trivial question, but I have a basic
understanding problem. If I have say pack1 and pack2, two R packages,
and pack2 depends on and imports pack1 fully (as in the code below), is
there a way to make all the functionality of pack1 available for the
global and other environments (not only for the functions called from
withing pack2) by loading pack2 only? I
2008 Apr 07
3
Overriding axis formatting with custom Axis method, Axis.numeric etc
Dear list:
I would like to override the default way R formats plot axes with a
custom method(s). Obviously I would prefer to define it as general as
possible avoiding writing a custom method for each individual class
where possible.
The plot.default method (and I assume other methods as well) calls
Axis(...) to produce the axis layout depending on data. In this sense it
seems reasonable to
2009 Mar 27
0
imporving performance of slicing on matrices and S4 their derivatives
Dear list.
It is a known issue that accessing slots of S4 objects and in particular
accessing .Data slots is slow in R. However, what surprises me are two
things demonstrated in the code below (runnable with 'inline', my times
are in the comments):
- copying data out of a large 3x1e7 .Data slot into a matrix can be
easily made 3-4 times faster than accessing a .Data slot which I believe
2008 Sep 03
1
ugly plots with xlim/ylim exceeding data range (changed since R2.6.1)
The behaviour of the plot function when used with xlim/ylim and the
matplot function as in the following simple example changed between
R2.6.1 and 2.7.0+ producing ugly plots in the new versions. In case of
plot it looks like the pretty function is called with wrong arguments
(i.e. range of supplied data rather than values of xlim and ylim):
m = matrix(c(-0.033, 0.009, 0.064, 0.050, 0.097,
2009 Nov 03
1
likely bug in 'serialize' or please explain the memory usage
Hi all,
assume the following problem: a function call takes a function object
and a data variable and calls this function with this data on a remote
host. It uses serialization to pass both the function and the data via a
socket connection to a remote host. The problem is that depending on the
way we call the same construct, the function may be serialized to
include the data, which was not
2008 Sep 04
0
patch for graphics/R/plot.R that fixes incorrect tick positions
As I haven't got any replies to my earlier posts about incorrect tick
positions in plot and matplot, here is the simplest patch to correct
this issue (it fixes both plot with xlim/ylim and matplot). The plot.R
was unchanged between 2.7 and current R-devel. It would be great if the
patch could be (tested and) applied to both the current patched and the
current devel versions.
70,71c70,71
<
2010 May 07
1
Bug in R -e "command"
Hi all:
since about a month we encountered a problem with R -e command: spaces
in the "command" of R -e "command" are no more tolerated. This same
issue affects 2.11 patched (05-05-2010), 2.10.1, and current devel (at
least the one of two weeks ago).
(I skip the mid of the printouts, replaced with ...)
* R -e "message('aaa aaa')"
ARGUMENT
2008 Apr 22
1
plot(x) in 2.7.0 (with y=NULL) proposed code correction
Hi all:
following the previous discussion, it looks like plot(x) with y=NULL
still does not work correctly. If one tries for example plot(1:5) it
works, but already for plot(runif(100)) it does not. I posted the
proposed correction for plot.POSIXct and plot.POSIXlt before. Please
voice your opinions whether the following fix for plot.default could be
reasonable? I include the full function and
2009 Mar 13
1
Rd \usage clause for an S4 replace method
Given S4 methods [ and [<-, how do I write the Rd-file usage clause for
the latter one?
What I have now is:
\S4method{[}{TimeSeries,TimeDate,missing}(x, i, j, ..., drop)
\S4method{[<-}{TimeSeries,TimeDate,missing,ANY}(x, i, j, ..., value)
which results in the following output:
## S4 method for signature 'TimeSeries, TimeDate, missing':
x[i, j, ..., drop]
2009 Mar 26
1
typo in sprintf format string segfaults R
typo as simple as %S instead of %s segfaults R devel:
*** R 2.9.0 (svn -r 47821) [/share/research/R-devel/20090203/lib64/R]
***
> sprintf("%S%d", "aaa", 1)
*** caught segfault ***
address 0x8000, cause 'memory not mapped'
Traceback:
1: sprintf("%S%d", "aaa", 1)
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit
2008 Apr 10
1
ISOdate/ISOdatetime performance suggestions, other date/time questions
Dear list:
working with date/times I have come across a problem that ISOdate and
ISOdatetime are too slow on large vectors of data. I was surprised just
until I looked at the implementation and the man page: "ISOdatetime and
ISOdate are convenience wrappers for strptime". In other terms, they
convert data to character representation first in order to create a
POSIXlt object that is then
2009 Mar 27
0
consistent segfaults in ROracle with one of the databases
Dear list.
Has anybody had any issues with ROracle, namely consistently leading to
a segmentation fault? One of our oracle databases seems to have certain
issues at the moment (do not know what exactly though) and if that one
is queried ROracle definitely fails with a segmentation fault. Any
ideas? Here is the trace and below is also a type of query that crashes
it:
*** caught segfault ***
2010 Jun 09
0
Documenting generic S4 replacement method for package building
Dear List Members,
I'm struggling with the documentation of a generic S4 replacement method.
I've created a S4 method "lows" via
setGeneric("lows", function(object) standardGeneric("lows"))
setGeneric("lows<-", function(object, value) standardGeneric("lows<-"))
setMethod("lows", "myClass", function(object)
{
2010 Jul 21
1
Bug: broken exception handling in S4 methods
Hi all:
we have noticed for quite a while that certain errors cannot be handled
by R try, tryCatch etc blocks, but it was fairly difficult to understand
what were the conditions for this incorrect behaviour. Finally I stabbed
across a very understandable case, which is outlined in the (runnable)
example below.
The main message is: wrapping an S4 method call in a try block will not
help if an
2014 Jan 07
1
Why do methods of "initialize" have no "srcref" attribute as other S4 mehtods?
For documentation we use a system that generates Rd files from special
comments in the code. (inlinedocs).
It is crucial to be able to get the defining source code for objects like
methods to extract the comments from it.
Here is an R session that shows how this works for several kinds of methods
and (at the end of the session) how if fails for methods of "initialize"
>
2005 Jun 02
1
showMethods doubt
Hi,
I'm developing in S4 and I wanted to see the methods for a specific
class using showMethods but I didn't succed. Can someone help ? See the
example below.
setClass("myclass",
representation(
name ="character"
)
)
setGeneric("mymeth", function(obj, ...){
standardGeneric("mymeth")
}
)
setMethod("mymeth",