Displaying 20 results from an estimated 2000 matches similar to: "Overwriting imported function in another package"
2015 Jan 21
2
reducing redundant work in methods package
Hi all,
The function call series genericForPrimitive -> .findBasicFuns -> .findAll
happens 4400 times while the GenomicRanges package is loading. Each time
.findAll follows a chain of environments to determine that the methods
namespace is the only one that holds a variable called .BasicFunsList. This
accounts for ~10% of package loading time. I'm sure there is some history
to that
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) {
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
2006 Feb 15
1
S3 generics without NS and cleanEx()
Good morning,
we recently observed a problem with importing S3 generics from a foreign
package (without namespace), defining a S3 method in a package _with_
namespace and the `cleanEx()' function which is automatically generated
and executed before examples are run by R CMD check.
To be more precise. Package `strucchange' defines a S3 generic
sctest <- function(x, ...)
2008 Feb 29
1
setHook and lattice
Hi,
I am trying to find a way to automate production of page numbers in plots
produced using the lattice package. To do this, I started playing around
with setHook which works fine with vanilla plot, but the hook 'plot.new'
doesn't appear to be relevant to the lattice package. I was wondering if
there is a alternative someone can suggest for use with the lattice package.
Example
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
2009 Jan 23
1
overwriting '<-' and infinite recursions
Hello all,
I'm having a problem when overwriting the '<-' function and was told
I'd better post it here for help. The reason why I need to overwrite
it is complicated and not easy to tell in a few words; but this seems
the only clean option other than hacking R's core source code. My code
looks like:
# in .onLoad of a package; or if you want to test, put it in a function
2009 May 14
1
Problem with viewports, print.trellis and more/newpage
Dear R-users,
I have got the following problem. I need to create 4x2 arrays of
xyplot's on several pages. The plots are created within a loop and
plotted using the print function. It seems that I cannot find the proper
grid syntax with my viewports, and the more/newpage arguments.
The following script is a simplification but hopefully will suffice to
illustrate my problem. Any suggestion
2016 Apr 05
1
[PATCH v3 04/16] mm/balloon: use general movable page feature into balloon
On 03/30/2016 09:12 AM, Minchan Kim wrote:
> Now, VM has a feature to migrate non-lru movable pages so
> balloon doesn't need custom migration hooks in migrate.c
> and compact.c. Instead, this patch implements page->mapping
> ->{isolate|migrate|putback} functions.
>
> With that, we could remove hooks for ballooning in general
> migration functions and make balloon
2016 Apr 05
1
[PATCH v3 04/16] mm/balloon: use general movable page feature into balloon
On 03/30/2016 09:12 AM, Minchan Kim wrote:
> Now, VM has a feature to migrate non-lru movable pages so
> balloon doesn't need custom migration hooks in migrate.c
> and compact.c. Instead, this patch implements page->mapping
> ->{isolate|migrate|putback} functions.
>
> With that, we could remove hooks for ballooning in general
> migration functions and make balloon
2015 Jul 04
1
[RFCv2 4/5] mm/compaction: compaction calls generic migration
On Fri, Jun 26, 2015 at 12:58 PM, Gioh Kim <gioh.kim at lge.com> wrote:
> Compaction calls interfaces of driver page migration
> instead of calling balloon migration directly.
>
> Signed-off-by: Gioh Kim <gioh.kim at lge.com>
> ---
> drivers/virtio/virtio_balloon.c | 1 +
> mm/compaction.c | 9 +++++----
> mm/migrate.c | 21
2015 Jul 04
1
[RFCv2 4/5] mm/compaction: compaction calls generic migration
On Fri, Jun 26, 2015 at 12:58 PM, Gioh Kim <gioh.kim at lge.com> wrote:
> Compaction calls interfaces of driver page migration
> instead of calling balloon migration directly.
>
> Signed-off-by: Gioh Kim <gioh.kim at lge.com>
> ---
> drivers/virtio/virtio_balloon.c | 1 +
> mm/compaction.c | 9 +++++----
> mm/migrate.c | 21
2011 May 31
1
assignInNamespace and new bindings
Hello,
assignInNamespace refuses to assign an object to a name that is not
already used in the namespace.
Something like this would make it possible:
--- src/library/utils/R/objects.R (revision 56024)
+++ src/library/utils/R/objects.R (working copy)
@@ -252,8 +252,9 @@
stop("environment specified is not a package")
ns <- asNamespace(substring(nm, 9L))
2015 Jul 27
1
[PATCH 4/4] mm: remove direct calling of migration
On 07/13/2015 10:35 AM, Gioh Kim wrote:
> From: Gioh Kim <gurugio at hanmail.net>
>
> Migration is completely generalized so that migrating mobile page
> is processed with lru-pages in move_to_new_page.
>
> Signed-off-by: Gioh Kim <gioh.kim at lge.com>
> Acked-by: Rafael Aquini <aquini at redhat.com>
Why not just fold this to Patch 3? You already modify this
2015 Jul 27
1
[PATCH 4/4] mm: remove direct calling of migration
On 07/13/2015 10:35 AM, Gioh Kim wrote:
> From: Gioh Kim <gurugio at hanmail.net>
>
> Migration is completely generalized so that migrating mobile page
> is processed with lru-pages in move_to_new_page.
>
> Signed-off-by: Gioh Kim <gioh.kim at lge.com>
> Acked-by: Rafael Aquini <aquini at redhat.com>
Why not just fold this to Patch 3? You already modify this
2016 May 27
2
[PATCH v6 02/12] mm: migrate: support non-lru movable page migration
On 05/20/2016 04:23 PM, Minchan Kim wrote:
> We have allowed migration for only LRU pages until now and it was
> enough to make high-order pages. But recently, embedded system(e.g.,
> webOS, android) uses lots of non-movable pages(e.g., zram, GPU memory)
> so we have seen several reports about troubles of small high-order
> allocation. For fixing the problem, there were several
2016 May 27
2
[PATCH v6 02/12] mm: migrate: support non-lru movable page migration
On 05/20/2016 04:23 PM, Minchan Kim wrote:
> We have allowed migration for only LRU pages until now and it was
> enough to make high-order pages. But recently, embedded system(e.g.,
> webOS, android) uses lots of non-movable pages(e.g., zram, GPU memory)
> so we have seen several reports about troubles of small high-order
> allocation. For fixing the problem, there were several