Giter Club home page Giter Club logo

Comments (6)

hadley avatar hadley commented on July 24, 2024

I'm not sure how to fix this bug - it's because when you load a new package it gets placed in the search path before your package, and so it can't find the functions. I'm not sure how R resolved this pre-namespaces.

You can work around it by doing load_all("pkg", T) after the package has been loaded.

from devtools.

hadley avatar hadley commented on July 24, 2024

For posterity, here are a couple of things that I thought might work but didn't :(

load_all("ggplot2")
setHook(packageEvent("maps", "attach"), 
  function(...) load_all("ggplot2", TRUE))
library(maps)
m <- map_data("world")

setHook(packageEvent("Hmisc", "attach"), 
  function(...) load_all("ggplot2", TRUE))
mean_cl_boot(1:100)
mean_cl_boot(1:100)

load_all("ggplot2")
setHook(packageEvent("Hmisc", "attach"), function(...) {
  env <- as.environment("package:ggplot2")
  detach("package:ggplot2")
  attach(env, name = "package:ggplot2", warn.conflicts = FALSE)
})
mean_cl_boot(1:100)

from devtools.

lendle avatar lendle commented on July 24, 2024

The workaround is helpful. Thanks! What about having devtools check the DESCRIPTION files for Suggests, and if it finds any, print out a message explaining the workaround?

from devtools.

hadley avatar hadley commented on July 24, 2024

I'd rather figure out how to solve it properly ;) I'll keep thinking about it.

from devtools.

hadley avatar hadley commented on July 24, 2024

There are hints at a solution at: http://stackoverflow.com/questions/8637107/parent-env-x-confusion. Devtools needs to generate an appropriate namespace environment that the package environment inherits from.

from devtools.

hadley avatar hadley commented on July 24, 2024

All suggested packages are now loaded automatically to work around this problem.

from devtools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.