Customize your R session with .Rprofile

October 23, 2013
By

(This article was first published on Revolutions, and kindly contributed to R-bloggers)

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 his blog: Revolutions.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.