search for: getnamespac

Displaying 20 results from an estimated 41 matches for "getnamespac".

Did you mean: getnamespace
2015 Jan 26
2
speedbump in library
>>>>> Winston Chang <winstonchang1 at gmail.com> >>>>> on Fri, 23 Jan 2015 10:15:53 -0600 writes: > I think you can simplify a little by replacing this: > pkg %in% loadedNamespaces() > with this: > .getNamespace(pkg) almost: It would be !is.null(.getNamespace(pkg)) > Whereas getNamespace(pkg) will load the package if it's not already > loaded, calling .getNamespace(pkg) (note the leading dot) won't load > the package. indeed. And you, Winston, are right that this...
2015 Jan 26
2
speedbump in library
...on Chang <winstonchang1 at gmail.com> on Fri, 23 >>>>>>> Jan 2015 10:15:53 -0600 writes: >> >> > I think you can simplify a little by replacing this: >> >> > pkg %in% loadedNamespaces() > with this: > >> .getNamespace(pkg) >> >> almost: It would be >> >> !is.null(.getNamespace(pkg)) >> >> > Whereas getNamespace(pkg) will load the package if it's >> not already > loaded, calling .getNamespace(pkg) (note >> the leading do...
2015 Jan 22
3
speedbump in library
...quot;))]) - } + paths <- file.path(lib.loc, pkg) + paths <- paths[ file.exists(file.path(paths, "DESCRIPTION")) ] if(use_loaded && pkg %in% loadedNamespaces()) { dir <- if (pkg == "base") system.file() else getNamespaceInfo(pkg, "path") Pete ____________________ Peter M. Haverty, Ph.D. Genentech, Inc. phaverty at gene.com
2015 Jan 26
0
speedbump in library
...gt;>>> Winston Chang <winstonchang1 at gmail.com> >>>>>> on Fri, 23 Jan 2015 10:15:53 -0600 writes: > > > I think you can simplify a little by replacing this: > > > pkg %in% loadedNamespaces() > > with this: > > .getNamespace(pkg) > > almost: It would be > > !is.null(.getNamespace(pkg)) > > > Whereas getNamespace(pkg) will load the package if it's not already > > loaded, calling .getNamespace(pkg) (note the leading dot) won't load > > the package. > > in...
2015 Jan 26
0
speedbump in library
...t gmail.com> on Fri, 23 > >>>>>>> Jan 2015 10:15:53 -0600 writes: > >> > >> > I think you can simplify a little by replacing this: > >> > >> > pkg %in% loadedNamespaces() > with this: > > >> .getNamespace(pkg) > >> > >> almost: It would be > >> > >> !is.null(.getNamespace(pkg)) > >> > >> > Whereas getNamespace(pkg) will load the package if it's > >> not already > loaded, calling .getNamespace(pkg) (...
2012 Aug 26
2
Package "datasets" not exporting anything on a recent R-2.15.1-patched
Hi, I just stumbled on the following apparent oddity: the package "datasets" does not appear to export anything out of its namespace: > ns_datasets <- getNamespace('datasets') > getNamespaceExports(ns_datasets) character(0) Not the case with other packages (example here with "utils"): > ns_utils <- getNamespace('utils') > head(getNamespaceExports(ns_utils)) [1] "?" ".DollarNames" "...
2013 Oct 29
1
unloadNamespace, getPackageName and "Created a package name xxx " warning
...some warnings Warning in FUN(X[[1L]], ...) : Created a package name, ‘2013-10-29 17:05:51’, when none found Warning in FUN(X[[1L]], ...) : Created a package name, ‘2013-10-29 17:05:51’, when none found ... The warning is produced by the getPackageName() function. e.g. getPackageName(parent.env(getNamespace('data.table'))) I was wondering what could be done to get rid of these warnings, which I believe in the case "unloadNamespace" case are irrelevant. The stack of calls is: # where 3: sapply(where, getPackageName) # where 4: findClass(what, classWhere) # where 5: .removeSuperclas...
2018 Apr 19
2
odd assignInNamespace / setGeneric interaction
...;> there is no package called ?.GlobalEnv? >> >> distr calls setGeneric("q"), which indirectly causes the environment >> of base::q, .GlobalEnv, to be loaded as a namespace, causing the error. >> Giving his replacement q function the environment getNamespace("base") >> avoids the problem. >> >> I can reproduce the problem by making a package that just calls >> setGeneric("as.hexmode",...) and a NAMEPACE file with >> exportMethods("as.hexmode"). If my .Rprofile puts a ver...
2018 Apr 19
0
odd assignInNamespace / setGeneric interaction
...that the environment of the function being replaced by an S4 generic is (or is the descendent of) the environment in which it lives. E.g., the following demonstrates the problem % R --quiet --vanilla > assignInNamespace("plot", function(x, ...) stop("No plotting allowed!"), getNamespace("graphics")) > library(stats4) Error: package or namespace load failed for ?stats4? in loadNamespace(name): there is no package called ?.GlobalEnv? and defining the bogus plot function in the graphics namespace avoids the problem % R --quiet --vanilla > assignInNamespace("...
2015 Jan 23
0
speedbump in library
I think you can simplify a little by replacing this: pkg %in% loadedNamespaces() with this: .getNamespace(pkg) Whereas getNamespace(pkg) will load the package if it's not already loaded, calling .getNamespace(pkg) (note the leading dot) won't load the package. I can't speak to whether there are any pitfalls in changing the library path searching, though. -Winston On Thu, Jan 22, 2015...
2009 Oct 26
1
How to browse all the functions in a package?
'?removeClass' shows that 'removeClass' is from package 'package:methods'. Is there a command which can show me all the functions and the classed defined in a package such as 'package:methods'?
2012 Mar 16
1
ggmap crash
...rid.Call.graphics(L_raster, x$raster, x$x, x$y, x$width, x$height, resolveHJust(x$just, x$hjust), resolveVJust(x$just, x$vjust), x$interpolate) 2: drawDetails.rastergrob(x, recording = FALSE) 3: drawDetails(x, recording = FALSE) 4: drawGrob(x) 5: recordGraphics(drawGrob(x), list(x = x), getNamespace("grid")) 6: grid.draw.grob(x$children[[i]], recording = FALSE) 7: grid.draw(x$children[[i]], recording = FALSE) 8: drawGTree(x) 9: recordGraphics(drawGTree(x), list(x = x), getNamespace("grid")) 10: grid.draw.gTree(x$children[[i]], recording = FALSE) 11: grid.draw(x$childre...
2010 May 27
2
Methods to explore R data structures
Hi, I'm very confused about R structures and the methods to go with them. I'm using R for microarray analysis with Bioconductors. Suppose without reading the documentations, what's the best way to explore a data structure when you know nothing about it? I am currently using is() / class() to see what the object is. str() / attributes() to probe inside the object, and
2018 Apr 18
2
odd assignInNamespace / setGeneric interaction
...espace load failed for ?distr? in loadNamespace(name): there is no package called ?.GlobalEnv? distr calls setGeneric("q"), which indirectly causes the environment of base::q, .GlobalEnv, to be loaded as a namespace, causing the error. Giving his replacement q function the environment getNamespace("base") avoids the problem. I can reproduce the problem by making a package that just calls setGeneric("as.hexmode",...) and a NAMEPACE file with exportMethods("as.hexmode"). If my .Rprofile puts a version of as.hexmode with environment .GlobalEnv into the base name...
2006 Oct 22
1
Getting hold of a package's environment from C code
Hi, I have a package where I'm calling an R function (say "foo") from C code. "foo" is in the same package, but is not exported. I construct the call using lang1(install("foo")), but to eval it I need the package's environment. Is there a way to do this? Passing the correct environment through .Call() is not an option. Right now, I'm getting the
2012 Dec 12
1
Problems with plot maps
...rey60", inherit.aes = FALSE, show_guide = FALSE), scale_x_continuous("", breaks = NULL, expand = c(0.02, 0)), scale_y_continuous("", breaks = NULL, expand = c(0.02, 0))) ggplot()+map_mp but I have such error "Error in recordGraphics(drawGTree(x), list(x = x), getNamespace("grid")) : invalid graphics state" What am I doing wrong?
2017 Jun 27
1
Wrong function when import from module using get
...for (module in analyses) { library(module, character.only = TRUE) } and I want to add a function isValid to each module, but I've added it only for AnalysisB. When I run this code: # value <- <selected by user> flags <- sapply(analyses, function(module) { namespace <- getNamespace(module) tryCatch({ isValid <- get("isValid", namespace) isValid(value) }, error = function(e) { TRUE }) }) # show analyses analyses[flags] then when R call get for AnalysisA it throw error, for AnalysisB it return function but for AnalysisC it re...
2012 Oct 30
6
standard error for quantile
...nt me to some reasoning? Thanks for all answers. Regards Petr PS. I found mcmcse package which shall compute the standard error but which I could not make to work probably because I do not have recent R-devel version installed Error in eval(expr, envir, enclos) : could not find function ".getNamespace" Error : unable to load R code in package 'mcmcse' Error: package/namespace load failed for 'mcmcse' Maybe I will also something find in quantreg package, but I did not went through it yet.
2013 Mar 20
0
How to avoid using gridextra via Depends instead of Imports in a package ?
...rather avoid messing with the search path, which is a best practice if I'm not mistaken, so we tried hard to solve it using Imports. But I came to realize that the problem was in the grid namespace, not in our package namespace. I tested it with the following work-around: parent.env(parent.env(getNamespace('grid'))) <- getNamespace('gridExtra') which works. So my questions are: * did we miss something obvious ? * what is the proper way to handle this situation ? Thanks in advance for your wisdom. Karl Forner
2014 Nov 24
1
Error "promise already under evaluation ..." with function(x, dim=dim(x))
...g the benchmarking and find faster solutions, I'm sharing the following: > library("microbenchmark") > x <- matrix(1:(80*80), nrow=80) > # Not "legal", because it calls .Primitive(). > dim_illegal <- base::dim > dim_R <- function(x) { + ns <- getNamespace("base") + dim <- get("dim", envir=ns, inherits=FALSE, mode="function") + dim(x) + } > dim_R_memoized <- local({ + dim <- NULL + function(x) { + if (is.null(dim)) { + dim <<- get("dim", envir=getNamespace("base")...