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

  • Home
  • SEARCH
  • 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 7836569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:12:46+00:00 2026-06-02T14:12:46+00:00

Could you suggest me a way for loading packages in R automatically? I mean,

  • 0

Could you suggest me a way for loading packages in R automatically? I mean, I want to start a session in R without needing to use library('package name') several times. Suppose I downloaded all packages I’ll want to use the next time I start R.

  • 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-02T14:12:47+00:00Added an answer on June 2, 2026 at 2:12 pm

    Put library(foo) in your .Rprofile file or set R_DEFAULT_PACKAGES: see ?Rprofile …

    In particular (because ?Rprofile is long and potentially intimidating):

    If you want a different set of packages than the default ones when you
    start, insert a call to ‘options’ in the ‘.Rprofile’ or
    ‘Rprofile.site’ file. For example, ‘options(defaultPackages =
    character())’ will attach no extra packages on startup (only the
    ‘base’ package) (or set ‘R_DEFAULT_PACKAGES=NULL’ as an environment
    variable before running R). Using ‘options(defaultPackages = “”)’ or
    ‘R_DEFAULT_PACKAGES=””’ enforces the R system default.

    Since you probably do want all of the default packages loaded, and then extra ones in addition (rather than, say, not loading some of the default packages), you can either put

    library("mypackage1")
    library("mypackage2")
    [etc.]
    

    or using options(defaultPackages=...):

    options(defaultPackages=c(getOption("defaultPackages"),
           "mypackage1","mypackage2", ... [etc.]))
    

    in your .Rprofile to append your desired packages to the standard defaults.

    edit (copied from comment) re getting this to work in Rstudio:
    http://rstudio.org/docs/using/workspaces suggests that Rstudio executes .Rprofile and then “Performs the other actions described in R Startup [ http://stat.ethz.ch/R-manual/R-patched/library/base/html/Startup.html ]” (which is the same as ?Rprofile). It is ambiguous whether it looks at Rprofile.site or not.

    edit #2: according to comment below, it does work with a recent version of Rstudio.

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

Sidebar

Related Questions

Hi Could anyone suggest me efficient of way of getting no of records in
Could you suggest a syntax for the C language to use it in a
Could somebody suggest a technique or class library to read up on for XML
could anyone suggest a way (other than using Task Manager) to track and log
Could please anybody suggest a way to deal with Inheritance regarding Page Objects pattern
Could somebody suggest a way to generate liquid bar charts similar to the following?
I wonder if anyone could suggest the best way of looping through all the
Could you suggest the best way to keep focus on a particular input field
Could someone suggest a way to change font in a dynamically created AlertDialog (in
Could anyone suggest books or materials to learn unit test? Some people consider codes

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.