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 6962305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:38:36+00:00 2026-05-27T15:38:36+00:00

How can I set a specific CRAN mirror permanently in R? I want to

  • 0

How can I set a specific CRAN mirror permanently in R?

I want to set it permanently in my laptop so that when I do install.packages(), it won’t ask me again which mirror to choose.

  • 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-05-27T15:38:37+00:00Added an answer on May 27, 2026 at 3:38 pm

    You can set repos in your .Rprofile to restore your choice every time you start R

    Edit: to be more precise:

    Add

    options(repos=c(CRAN="THE URL OF YOUR FAVORITE MIRROR"))
    

    to your .Rprofile, located in the home directory of your user.

    You can find a list of CRAN mirrors here.

    Example:

    # add this line to ~/.Rprofile, restart your R session so it takes effect
    options(repos=c(CRAN="http://cran.r-project.org"))
    

    Alternatively, you can set the mirror site-wide in your Rprofile.site. The location of the file is given by ?Startup:

    The
    path of this file is taken from the value of the R_PROFILE
    environment variable (after tilde expansion). If this variable is
    unset, the default is R_HOME/etc/Rprofile.site, which is used if
    it exists (which it does not in a ‘factory-fresh’ installation).

    So do Sys.getenv("R_PROFILE") for the first option, or Sys.getenv("R_HOME") or R.home() for the second option. On macOS, the location of the second is /Library/Frameworks/R.framework/Resources/etc/.

    The file may not exist, or you may see the following lines commented out :

    # set a CRAN mirror
    # local({r <- getOption("repos")
    #       r["CRAN"] <- "http://my.local.cran"
    #       options(repos=r)})
    

    So remove the comment marks and change "http://my.local.cran&quot; to the correct website, e.g.:

    local({r <- getOption("repos")
           r["CRAN"] <- "http://cran.r-project.org"
           options(repos=r)})
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found that I can set the task to run at specific interval at
I am developing a silverlight application where you can set sales target for specific
In Photoshop you can set a layer's blending mode to be Hue. If that
I understand that we can set the various style attributes from code behind using
I have a perl script for which ENV variables can be set to direct
Wondering if there is some preference I can set in excel so that when
How can I set a specific margin for Firefox in CSS? I tried -moz-margin:0px;
So I know you can set the default sort order of specific columns with
We know that, we can set a permalink structure for wordpress from settings. But,
Hi I know that I can set the rest authentication in Phil Sturgeons rest

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.