Questions tagged [rprofile]

The R statistical package uses both or either Rprofile.site or .Rprofile to load startup requirements.

The R statistical package uses both or either Rprofile.site or .Rprofile to load startup requirements. .Rprofile instances may be multiple and can be directory/project specific.

62 questions
286
votes
24 answers

Expert R users, what's in your .Rprofile?

I have always found startup profile files of other people both useful and instructive about the language. Moreover, while I have some customization for Bash and Vim, I have nothing for R. For example, one thing I always wanted is different colors…
gappy
  • 10,095
  • 14
  • 54
  • 73
76
votes
1 answer

Locate the ".Rprofile" file generating default options

In R and RStudio, I think I have messed around with the .Rprofile file a few times, and I currently am loading up an old version of it upon startup of R or RStudio, is there a way that I can quickly find the location of the file that is generating…
h.l.m
  • 13,015
  • 22
  • 82
  • 169
11
votes
1 answer

Getting .Rprofile to Load at Startup

I have a global ~/.Rprofile file and another .Rprofile file located in my project's current working directory and both of the have the following contents: .First() <- function() { options(rstudio.markdownToHTML = function(inputFile, outputFile) {…
rsacc
  • 723
  • 1
  • 8
  • 11
9
votes
1 answer

.Rprofile not sourced

I am trying to set some global options for blogdown package in ~/.Rprofile script but they are not being sourced. Here's how the .Rprofile script looks like: options(blogdown.ext = ".Rmd", blogdown.author = "Maryam Khezrzadeh") I have also tried…
mkhezr
  • 564
  • 5
  • 10
8
votes
1 answer

How to change .Rprofile location in RStudio

I am working with a "factory fresh" version of RStudio on Windows 7. R is installed under C:/Program Files which means the default libraries are stored here, and the two locations contained in .libPaths() on startup are both within this folder. I…
Nick
  • 366
  • 1
  • 4
  • 10
6
votes
2 answers

Exit R terminal by typing `exit`?

Almost every tool I use can be exited from terminal by typing exit. But R, being "unique" requires I type q(). Can I set-up something in .Rprofile to achieve this?
jessexknight
  • 756
  • 7
  • 20
4
votes
1 answer

Temporarily Disable Rprofile

How do I temporarily disable Rprofile. short of renaming the file? Is there an elegant way to toggle my Rprofile on and off upon startup of RStudio?
stackinator
  • 5,429
  • 8
  • 43
  • 84
4
votes
1 answer

Accessing function's parent environment and removing objects

Let's say that I want to write a simple rename function that would load through .Rprofile. The function is simple and can be compared to: carsNewName <- mtcars; rm(mtcars) .Rprofile The function available in .Rprofile would be of…
Konrad
  • 17,740
  • 16
  • 106
  • 167
4
votes
0 answers

Source multiple files in Rprofile

I'm running into an issue when sourcing two files in my .Rprofile. It seems that my second source() call is occurring before my first source call is finished. Below is my .Rprofile and a description of the behavior I see. .First <- function() { …
3
votes
1 answer

renv + venv + jupyterlab + IRkernel: will it blend?

Short version What is the simple and elegant way to use renv, venv and jupyterlab with IRkernel together? In particular, how to automatically activate renv from jupyter notebook that is not in the root directory? Long version I'm embracing a…
psarka
  • 1,562
  • 1
  • 13
  • 25
3
votes
1 answer

Sourcing in Rprofile.site: How to find the location of the sourced file

I have a "copy deployed" installation of R with no R-specific environment variables set. I want to source a file from within Rprofile.site: source("how/to/find/this/file/my_settings.R") Where could I place my my_settings.R file so that it can be…
R Yoda
  • 8,358
  • 2
  • 50
  • 87
3
votes
3 answers

Installing packages from RProfile.site file

I asked this question earlier, but am still unable to get it working. I am trying to install custom packages upon starting R. A lot of the code that is written by us right now is available for editing to the users. To try and protect the code, I am…
abhisarihan
  • 251
  • 3
  • 12
2
votes
4 answers

Hide some functions from .Rprofile

I have several functions in my .Rprofile file: f1 <- function() { ...... } f2 <- function() { ...... } g <- function() { ...... } The functions f1 and f2 are helper functions for g, and I don't want them in the global environnement. How could I…
Stéphane Laurent
  • 75,186
  • 15
  • 119
  • 225
2
votes
0 answers

R: Create environment in .Rprofile

When I use following snippet in my .Rprofile file of a project: .env <- new.env() .env$test <- function() { print("sfsdfsd") } and open the project in RStudio, ".env" isn't created: ls(envir=.env) returns Error in ls(envir = .env) : object…
Peter W.
  • 21
  • 2
2
votes
1 answer

Changing packages directory in Rprofile

I have a project called "R installation info" And a sub directory called "Project Packages". I am trying to configure R in a manner that when I Install a new package it will be installed to "Project Packages". Also when I have an R session with…
Rafael Zanzoori
  • 531
  • 1
  • 7
  • 23
1
2 3 4 5