Customize your R session with .Rprofile

[This article was first published on Revolutions, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The .Rprofile file is a great way to customize your R session every time you start it up. You can use it to change R's defaults, define handy command-line functions, automatically load your favourite packages — anything you like! The Getting Genetics Blog has a nice example .Rprofile file to give you some inspiration on what to do. One popular setting is options(stringsAsFactors=FALSE), which prevents R from converting character data into factor objects when you import data frames.

One word of warning: if you often share R scripts with others, don't get too reliant on your .RProfile file. Your script may be assuming default settings that your colleagues may not share. Be sure to check your script still runs correctly when you start R with R –no-init-file before you share it. Check help(Startup) in R for details.

Getting Genetics Done: Customize your .Rprofile and Keep Your Workspace Clean

To leave a comment for the author, please follow the link and comment on their blog: Revolutions.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)