Displaying 20 results from an estimated 300 matches similar to: "reducing redundant work in methods package"
2015 Jan 21
2
reducing redundant work in methods package
Doing it like this:
genericForPrimitive <- function(f, where = topenv(parent.frame()), mustFind
= TRUE) {
ans = .BasicFunsList[[f]]
## this element may not exist (yet, during loading), dom't test null
if(mustFind && identical(ans, FALSE))
stop(gettextf("methods may not be defined for primitive function %s
in this version of R",
2015 Jan 21
0
reducing redundant work in methods package
Note that setMethod() resolves .BasicFunsList in the methods namespace
directly when setting a method on a primitive. Somehow there should be
consistency between genericForPrimitive() and the check in setMethod().
Also, we can probably step away from the use of elNamed(), given that [[
now uses exact matching.
Have you tried patching methods to use .BasicFunsList directly as in
setMethod?
On
2015 Jan 22
0
reducing redundant work in methods package
I also just noticed that there is a bug: identical(ans, FALSE) should
be is.null(ans).
So no error is thrown:
> methods:::genericForPrimitive("foo")
NULL
Will fix.
On Wed, Jan 21, 2015 at 3:13 PM, Peter Haverty <haverty.peter at gene.com> wrote:
> Doing it like this:
>
> genericForPrimitive <- function(f, where = topenv(parent.frame()), mustFind
> = TRUE) {
2007 Jan 25
1
"rep" missing from methods:::.BasicFunsList
With:
R version 2.4.1 Patched (2007-01-22 r40548)
"rep" is missing from methods:::.BasicFunsList, causing
methods:::genericForPrimitive("rep") to fail, which in turn causes
setMethod("rep", ...) to fail. (setGeneric("rep") of course fails as it
should, saying that rep is a primitive and methods can be set).
Here's the fix:
build_main at
2004 Jun 26
1
S4 group "Math", "getGroupMembers", "genericForPrimitive"
Hi,
I found the following on Windows 2000/NT
R Version 1.9.1 (2004-06-21) (also Version 1.9.0):
The S4 group "Math" doesn't work as documented; i.e., "log", "log10",
"gamma" and "lgamma" are included
in the documentation but don't work. See example code below.
Moreover, what about 'genericForPrimitive' which is used
in
2013 Mar 26
2
when to use which apply function?
Dear list,
I am a little confused as to when to use apply, sapply, tapply, vapply,
replicate. I've encountered this several times,
This is time, this is what I am working on,
mat <- matrix(c(seq(from=1, to=10), rnorm(10)), ncol=2)
a=1; b=5
newfun <- function(x, y, a, b)
{
x*y+a+b
}
sapply(i=1:10, newfun(x=mat[i, 1], y=mat[i, 2], a=a, b=b))
Error in match.fun(FUN) : argument
2011 Aug 08
1
Overwriting imported function in another package
I am running into a limitation of the grid::grid.newpage function, for
which I would like to overwrite this function with a slightly modified
one. Hopefully this is a temporary working solution until the package
gets updated. I found a way to overwrite the function in the
package:grid namespace. However, lattice imports grid rather than
depending on it. So I need a way to overwrite this imported
2015 Aug 13
2
[lld] Alias in COFF short import library.
>
> If you want to define an alias symbol "bar" to "foo" (which is an
> extension you want to provide), one way is to create an object file that
> defines "bar" and "__imp_bar" as aliases to "foo" and "__imp_foo",
> respectively, and add that object file to the import library. As a result,
> the import library file
2001 Mar 20
3
Newbie question about by() -- update
Sorry about the lack of detail. I am running R v.1.2.2. I can recast my
question
(which I think I have partially answered) more succinctly as follows:
1. This seems to work (note that group takes values 1,2,3,4, or 5):
my.newfun <- function(x) myfile <- lm(award ~ ilogemp + ilogage, x)
test.by <- by(wintemp, as.factor(wintemp$group), my.newfun)
2. This does not work (leaving aside
2005 Jan 13
3
as.character methods
Hello,
?as.character says that the as.character function is a generic with
usage: as.character(x, ...). So, I want to create an S4 object with an
as.character method following the above usage, but I get the below error
telling me that ... isn't in the generic for as.character.
> setClass("tmp", "numeric")
> setMethod("as.character", "tmp",
2005 Jan 13
3
as.character methods
Hello,
?as.character says that the as.character function is a generic with
usage: as.character(x, ...). So, I want to create an S4 object with an
as.character method following the above usage, but I get the below error
telling me that ... isn't in the generic for as.character.
> setClass("tmp", "numeric")
> setMethod("as.character", "tmp",
2004 Jul 14
2
tracing something in a namespace (PR#7091)
# Your mailer is set to "none" (default on Windows),
# hence we cannot send the bug report directly from R.
# Please copy the bug report (after finishing it) to
# your favorite email program and send it to
#
# r-bugs@r-project.org
#
######################################################
> x <- rnorm(10)
> y <- 1:10
> xyplot(y ~ x)
>
2012 Mar 07
1
isGeneric() can return an error
Hi,
I wonder if this is a feature or a bug:
> isGeneric("&&")
Error in genericForPrimitive(f) :
methods may not be defined for primitive function ?&&? in this
version of R
> isGeneric(":")
Error in genericForPrimitive(f) :
methods may not be defined for primitive function ?:? in this
version of R
According to the man page:
2015 Aug 13
2
[lld] Alias in COFF short import library.
>
> The header of libuser32b.a says that it defines MessageBoxB and
> __imp_MessageBoxB, but the import library file in the archive actually
> defines MessageBoxA (not B). So the archive file is broken. You may want to
> fix the header and try again.
Yes this is how I done the alias.
If you consider this invalid then look at libuser32.a
The header defines MessageBoxA and
2018 Aug 20
2
Call for testing: OpenSSH 7.8
On 17/08/2018 17:15, Ingo Schwarze wrote:
> Hi Darren,
>
> Darren Tucker wrote on Fri, Aug 17, 2018 at 07:16:03AM -0700:
>> On 13 August 2018 at 15:06, Val Baranov <val.baranov at duke.edu> wrote:
>>> test_utf8: ........................
>>> regress/unittests/utf8/tests.c:48 test #25 "c_esc"
>>> ASSERT_INT_EQ(len, wantlen) failed:
2018 Aug 17
4
Call for testing: OpenSSH 7.8
On 13 August 2018 at 15:06, Val Baranov <val.baranov at duke.edu> wrote:
[...]
> test_utf8: ........................
> regress/unittests/utf8/tests.c:48 test #25 "c_esc"
> ASSERT_INT_EQ(len, wantlen) failed:
> len = -1
> wantlen = 5
This boils down to meaning OpenSSH's smnprintf call failed for the
string "\033x" instead of returning the
2015 Mar 03
2
openssh-SNAP-20150304 issues
Damien Miller wrote:
>
> On Tue, 3 Mar 2015, The Doctor wrote:
>
>> regress/unittests/test_helper/test_helper.c: In function `test_data_file':
>> regress/unittests/test_helper/test_helper.c:177: warning: implicit declaration of function `strlcpy'
>> regress/unittests/test_helper/test_helper.c: At top level:
>>
2018 Aug 13
1
trace in uniroot() ?
Despite my years with R, I didn't know about trace(). Thanks.
However, my decades in the minimization and root finding game make me like having
a trace that gives some info on the operation, the argument and the current function value.
I've usually found glitches are a result of things like >= rather than > in tests etc., and
knowing what was done is the quickest way to get there.
2011 Jan 05
0
[PATCH] fix %n expansion in LocalCommand
After the commit titled "expand %h to the hostname in ssh_config Hostname
options" (2010-07-16), %n always got the same value as %h in the LocalCommand
config option. Fix this and add a regression test.
---
regress/Makefile | 6 ++++--
regress/host-expand.sh | 18 ++++++++++++++++++
ssh.c | 6 ++++--
3 files changed, 26 insertions(+), 4 deletions(-)
diff
2015 Mar 03
2
openssh-SNAP-20150304 issues
Script started on Tue Mar 3 07:35:34 2015
doctor.nl2k.ab.ca//usr/source/openssh-SNAP-20150304$ make tests
[ -d `pwd`/regress ] || mkdir -p `pwd`/regress
[ -d `pwd`/regress/unittests ] || mkdir -p `pwd`/regress/unittests
[ -d `pwd`/regress/unittests/test_helper ] || mkdir -p `pwd`/regress/unittests/test_helper
[ -d `pwd`/regress/unittests/sshbuf ] || mkdir -p `pwd`/regress/unittests/sshbuf
[ -d