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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:06:10+00:00 2026-06-04T01:06:10+00:00

I am fairly new to R programming. I am trying to customize my R

  • 0

I am fairly new to R programming. I am trying to customize my R setup so that when an R session is started a few packages are installed at the beginning. I know that there is a .First() function that I can write in the Rprofile.site file. However, upon adding my install package code inside the .First() function, the package does not get installed.

Furthermore, it seems to go into a loop of trying to create the package and it creates a lock file in the library folder in R. This causes my computer to really slow down (almost to the point where it is frozen) because it keeps trying to install that package.

Here is the code that I have added to the end of the Rprofile.site file.

.First <- function() {
  install.packages("customPackage.tar.gz", repos=NULL, type="source")
  cat("\nWelcome to R on ", date(), "\n") 
}

I even tried adding the install.packages line just by itself in the file (without having a .First() function) to no avail.

The customPackage.tar.gz refers to a package I built up using existing code that I have written up. Since this is a custom package, the repos is NULL. If I do not include this line in my .First() function and just run the command after launching the R session, the package gets installed just fine in the R/R-2.15.0/library folder.

There are several custom packages that I need to have installed upon the beginning of an R session, and that’s why it is important that I add all these installation lines of code in the Rprofile.site file. Any ideas on how I can do this? Everywhere I have looked online on customizing the Rprofile.site file shows examples of just using libraries that already exist (For example, library(R2HTML)), but nothing for installing new libraries. Thanks for the help!

Edit: Thanks for the help guys! I actually do need to install these packages in multiple machines for each user and instead of having them manually install the package once, I figured it’ll be good to do it in the site file. I tried Justin’s suggestion for checking the package first and that worked! Thanks for the help again!

  • 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-04T01:06:11+00:00Added an answer on June 4, 2026 at 1:06 am

    Unless you’re switching from computer to computer you should have this package already in your library (that is once you install a package once it should always be there). Use installed.packages() [,1] or library() to see all packages in your library. If you see it there then use this:

    .First <- function() {
      require(customPackage)
      cat("\nWelcome to R on ", date(), "\n") 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm fairly new to C programming but trying my best to understand it. I
I am fairly new to database programming and am trying to get a basic
I'm fairly new to iPhone programming and am trying to implement a double-component PickerView.
I'm fairly new to programming, and there's one thing I'm confused by. What is
I am fairly new to Objective C and iOS programming but am constantly trying
First off, i'm fairly new to programming, I've built a few asmx web services
I'm fairly new to Python and programming in general. I have done a few
I'm fairly new to C++ programming and I've been getting an error that I
I'm fairly new to localized programming, and I'm trying to figure out how to
I'm fairly new to programming for ARM. I've noticed there are several architectures like

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.