Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7928751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:50:12+00:00 2026-06-03T19:50:12+00:00

I have always assumed that having a package in the ‘Depends’ field would automatically

  • 0

I have always assumed that having a package in the ‘Depends’ field would automatically also import the namespace. However, it seems that in R 2.15, dependencies do not become available until the package is actually attached to the searchpath. Is this intended behavior?

The problem appears as follows: Suppose there is a package ‘Child’ which Depends, but does not explicitly Import a package called ‘Parent’ and contains a function that calls out to an object in the namespace of ‘Parent’. Then when this function is called without actually attaching ‘Child’, the function in ‘Parent’ cannot be found.

Here an example from the manual of the bigdata package, but the problem is very widespread:

x = matrix(rnorm(50*80),50,80)
beta = c(3,2,1.5,rep(0,77))
y = rnorm(50) + x%*%beta
z1 = bigdata::lasso.stars(x,y)

The example fails because lasso.stars depends on ‘glmnet’ which is not loaded until bigdata is attached. The only way to be able to call lasso.stars is to actually attach the bigdata package:

library(bigdata)
z1 = bigdata::lasso.stars(x,y)

Now to further complicate things, it seems that this problem is inherited to any ‘grandchild’ package that Imports in this case the lasso.stars function. I have a hard time finding a good example but I am sure they are out there.

Is this a bug? I know that it can be avoided by asking package authors to use Imports instead of Depends, but in practice the majority of the packages on CRAN still use Depends. It seems like the problem is easily avoided if R would automatically import the namespace of any Depends packages into to the child package namespace.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T19:50:13+00:00Added an answer on June 3, 2026 at 7:50 pm

    For those that are interested, the discussion continues here on the r-devel mailing list:

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason I have always assumed that most of the time a variable
The default input type is 'text'. I have always assumed then that CSS declarations
I have always thought that in order to connect to SQL server using windows
I have always been a bit unclear on the type of tasks that should
The problem I'm having is that my Bean Validation isn't working as I would
I've always assumed: that a char is represented by a byte, that a byte
I always assumed that chaining multiple filter() calls in Django was always the same
I have always wondered about this. So many application setups have a zip file
I have always enabled integrated security on my web apps inside IIS with the
I have always wondered how delegates can be useful and why shall we use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.