You can enlarge any page by clicking on the = box. In this case it will occupy all left or right
pane. You can manually enlarge with of the pane by dragging the border. Actually it makes sense to make
left pane wider then the right during debugging and vise versa when viewing graphic results.
You work in RStudio from opening it to closing it is called session. When you try to close RStudio
it asks you whether to save session. If you answer yes the configuration of windows, you Tools/Global_options
settings, history of command and several other things are saved in a special file and are restored
when you open RStudio again.
Like in Visual Studio you can group several functions and data in RStudio in so called projects.
A project, which is a folder in filesystem with a several special files, written to it by RStudio.
In other words a project is a collection of files— R scripts and data file as well as results
and graphs — that are all related to each other and stored in its own working directory. This agreement
help to keep your files organized.
When project is opened those special files are loaded automatically creating environment that is
close to the one you used to have when you last close the project.
Creating or opening RStudio project also sets R working directory. You do not need to set it separately
using
Creating or opening RStudio project also sets R working directory. You do not need to set
it separately |
You can create an RStudio project:
- In a brand new directory
- In an existing directory where you already have R code and data
- By cloning a version control (Git or Subversion) repository
To create a new project use the Create Project command (available on the Projects
menu and on the global toolbar):
When a new project is created RStudio:
- Creates a project file (with the extension.Rproj ) in the project directory.
This file contains various project options and can also be used as a shortcut for opening the project
directly from the filesystem.
- Creates a hidden directory (named .Rproj.user ) where project-specific temporary
files (e.g. auto-saved source documents, window-state, etc.) are stored. This directory is also
automatically added to .Rbuildignore, .gitignore, etc. if required.
- Loads the project into RStudio and display its name in the Projects toolbar (which is
located on the far right side of the main toolbar)
There are several ways to open a project:
- Using the Open Project command (available from both File/OpenPrject and the
Projects toolbar ( at the very right of the icon toolbar) to browse for and select an existing project
file (e.g. MyProject.Rproj).
- Selecting a project from the list of most recently opened projects (also available from both
the Projects menu and toolbar).
- Double-clicking on the project file within the system shell (e.g. clicking on file Windows Explorer).
When a project is opened within RStudio the following actions are taken:
- A new R session (process) is started
- The .Rprofile file in the project's main directory (if any) is sourced by R
- The .RData file in the project's main directory is loaded (if project options indicate
that it should be loaded).
- The .Rhistory file in the project's main directory is loaded into the RStudio History
pane (and used for Console Up/Down arrow command history).
- The current working directory is set to the project directory.
- Previously edited source documents are restored into editor tabs
- Other RStudio settings (e.g. active tabs, splitter positions, etc.) are restored to where they
were the last time the project was closed.
When you are within a project and choose to either Quit, close the project, or open another project
the following actions are taken:
- .RData and/or .Rhistory are written to the project directory (if current options
indicate they should be)
- The list of open source documents is saved (so it can be restored next time the project is opened)
- Other RStudio settings (as described above) are saved.
- The R session is terminated.
You can work with more than one RStudio project at a time by simply opening each project in its own
instance of RStudio. There are two ways to accomplish this:
- Use the Open Project in New Window command located on the Project menu.
- Opening multiple project files via the system shell (i.e. double-clicking on the project file).
There are several options that can be set on a per-project basis to customize the behavior of RStudio.
You can edit these options using the Project Options command on the Project
menu:
R command line provides access to help. try ?[function] or ??"[topic]"
This is different from an R
session, which is all the objects and work done in
R
and kept in memory for the current usage period, which usually resets upon restarting
R
.
The simplest way to start a new project is to click File >> New Project
You will be presented with the initial menu that contains three option. The simplest is to start
project using a directory. As you can see three options are available: starting a new project in a new
directory, associating a project with an existing directory or checking out a project from a version
control repository such as Git or SVN. In all three cases a .Rproj
file is put into the
resulting directory to keeps track of the project.
Choosing to create a new directory brings up a dialog, that requests a project name and where to
create a new directory.
Choosing an existing directory asks for the name of the directory:
This way you can convert existing directory with data and R scripts into a project.
There are also options to use GIT or other version management system, but we will omit this
option for now.
When typing code, such as an object name or function name, hitting Tab
will auto complete
the code. If more than one object or function matches the letters typed so far, a dialog will pop up
giving the matching options.
Editor function are listed in two tabs: Edit and Code. As you can see from Edit dialog of the main
upper bar of RStudio, the Edit tab contains more or less standard capabilities typical for most editors.
Code tab is more interesting. In it the built-in editor provide several interesting capabilities:
Among them:
- Insert Section (Ctrl-Shift-R)
- Go to File/function (Ctrl-.)
- Go to Function definition
- Reindent lines (Ctrl-I)
- Comment/Uncomment Lines (Chrl-Shift-C)
- Run Line Ctrl-Enter
- Re-Run line Ctrl-Shift-P
- Run region
- Source current editor buffer (Ctrl-Shift-S)
For a complete list of shortcuts click Help/Keyboard Shortcuts
(Alt-Shift-K)
There are several ways to send and execute commands from the editor to the console.
- To execute one line place the cursor at the line and press
Ctrl+Enter
.
- To execute a selection, simply highlight the selection and press
Ctrl+Enter
.
- To run an entire code in the editor window, press
Ctrl+Shift+S
.
Customarization of RStudio
RStudio is customizable via options in Tools/Global_Options
:
General options. There is a control for selecting which version of R
to use.
This is a powerful tool when a computer has a number of versions of R
. However, RStudio
must be restarted after changing the R
version. It is also a good idea to not restore
or save .RData
files on startup and exiting. RData
files are a convenient
way of saving and sharing R
objects.
The Code Editing options, control the way code is entered and displayed in the
text editor. It is generally considered good practice to replace tabs with spaces, either two or four.
Users with strong Unix experience might benefit from vim mode.
Appearance options, change the way code looks, aesthetically. The font, size and color
of the background and text can all be customized here. The first thing to customize is size of the font
to display R programs in Tools/Global Options/Appearance. The default fond is Lucida Console
and its OK. The default fond size is 10 and its too small. I would recommend 11 or higher. With 10 it
is difficult to distinguish some symbols such as comma and dot.
The Pane Layout options, allow to specify which tabs upper left pane and lower right pane
should contain.
The Packages options allow specify you CRAN mirror, which is important if you in network environment
with proxy. You can pick up the mirror that is geographically the closest and reliable
Sweave option allow you to choose between using Sweave or knitr
. Both are used for the
generation of PDF documents with knitr
also enabling the creation of HTML
documents. knitr
might be the better option, although it must first be installed. This
is also where the PDF viewer is selected.
RStudio contains a spelling checker for writing LATEX and Markdown documents (using knitr
,
preferably), which is controlled from the Spelling options. Not much needs to be set here.
The last option, Git/SVN, indicates where the executables for Git and SVN exist. This needs to be
set only once but is necessary for version control.
RStudio Server v0.99 requires RedHat or CentOS version 5.4 (or higher) as well as an installation of R. You can install R for RedHat
and CentOS using the instructions on CRAN: https://cran.rstudio.com/bin/linux/redhat/README
.
RedHat/CentOS 6 and 7
To download and install RStudio Server open a terminal window and execute the commands corresponding to the 32 or 64-bit version
as appropriate.
64bit
Size: 43.5 MB MD5: 1e973cd9532d435d8a980bf84ec85c30 Version: 1.1.383 Released: 2017-10-09
$ wget https://download2.rstudio.org/rstudio-server-rhel-1.1.383-x86_64.rpm
$ sudo yum install --nogpgcheck rstudio-server-rhel-1.1.383-x86_64.rpm
See the Getting Started document for information
on configuring and managing the server.
Read the RStudio Server Professional Admin Guide for more
detailed instructions.
RStudio is a relatively new and shiny editor for R. It's easy to use, it has
a decent Help page, it has very good support, and it incorporates R in a practical way. Of course,
you're free to work with any text editor you like.
Installing RStudio is easy. Just follow these steps:
-
Go to RStudio Download.
-
Click the Download RStudio Desktop button.
-
Select the installation file for your system.
-
Run the installation file.
RStudio will be installed on your system. It normally detects your latest installed R version
automatically. If you didn't do anything funky, you should be able to use R from within RStudio without
extra configuration.
You may want to use a different R version from the one RStudio detected. For example, you may
want to use R in a 64-bit context. Or RStudio may not have recognized your installation of R. In
that case, you can set which R version to use by choosing Tools→Options to open the Options pane.
To change the R version, click the Change button. Then you can switch between the default 32-bit
R installation or the 64-bit R installation (if installed), or you can choose a specific version
of R. (RStudio lists all the versions it can find.)
If you click Browse, you can select the root directory for any R version you want to use. This
folder normally looks something like …/R/R-n.n.n. If you select an R version that has both 32-bit
and 64-bit builds, RStudio will ask you which build you want to use.
In the Options pane, you also can tweak the behavior of R in RStudio. If you click the General
icon in the left column, you get all the default options for R in RStudio:
-
Initial working directory: You can set the default working directory R will use at startup.
-
Save workspace to .RData on exit: Your options are Ask, Never, or Always. By default,
RStudio asks you whether you want to save the workspace when you quit.
-
Restore .RData into workspace at startup: Select this check box to let RStudio restore
the workspace automatically at startup. RStudio will look for a saved workspace in the root folder
or the default working directory.
-
Always save history (even when not saving .RData): Select this check box to have RStudio
always save the history. If you don't select this check box, RStudio doesn't save the history
when you exit the program.
-
Use single global history (rather than per-working directory): Select this check box
to have RStudio always save the history in a single global file.
-
Remove duplicate entries in history: If you select this check box, RStudio removes duplicate
entries from your history when the history is saved.
-
Comprehensive R Archive Network (CRAN) mirror: Click the Change button to set the CRAN
mirror site that RStudio uses to install new packages.
These settings work for R only from within RStudio. If you use R with another editor or by itself,
the settings in RStudio will have no effect.
Softpanorama Recommended
How to
Install and Configure RStudio - For Dummies
Society
Groupthink :
Two Party System
as Polyarchy :
Corruption of Regulators :
Bureaucracies :
Understanding Micromanagers
and Control Freaks : Toxic Managers :
Harvard Mafia :
Diplomatic Communication
: Surviving a Bad Performance
Review : Insufficient Retirement Funds as
Immanent Problem of Neoliberal Regime : PseudoScience :
Who Rules America :
Neoliberalism
: The Iron
Law of Oligarchy :
Libertarian Philosophy
Quotes
War and Peace
: Skeptical
Finance : John
Kenneth Galbraith :Talleyrand :
Oscar Wilde :
Otto Von Bismarck :
Keynes :
George Carlin :
Skeptics :
Propaganda : SE
quotes : Language Design and Programming Quotes :
Random IT-related quotes :
Somerset Maugham :
Marcus Aurelius :
Kurt Vonnegut :
Eric Hoffer :
Winston Churchill :
Napoleon Bonaparte :
Ambrose Bierce :
Bernard Shaw :
Mark Twain Quotes
Bulletin:
Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient
markets hypothesis :
Political Skeptic Bulletin, 2013 :
Unemployment Bulletin, 2010 :
Vol 23, No.10
(October, 2011) An observation about corporate security departments :
Slightly Skeptical Euromaydan Chronicles, June 2014 :
Greenspan legacy bulletin, 2008 :
Vol 25, No.10 (October, 2013) Cryptolocker Trojan
(Win32/Crilock.A) :
Vol 25, No.08 (August, 2013) Cloud providers
as intelligence collection hubs :
Financial Humor Bulletin, 2010 :
Inequality Bulletin, 2009 :
Financial Humor Bulletin, 2008 :
Copyleft Problems
Bulletin, 2004 :
Financial Humor Bulletin, 2011 :
Energy Bulletin, 2010 :
Malware Protection Bulletin, 2010 : Vol 26,
No.1 (January, 2013) Object-Oriented Cult :
Political Skeptic Bulletin, 2011 :
Vol 23, No.11 (November, 2011) Softpanorama classification
of sysadmin horror stories : Vol 25, No.05
(May, 2013) Corporate bullshit as a communication method :
Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law
History:
Fifty glorious years (1950-2000):
the triumph of the US computer engineering :
Donald Knuth : TAoCP
and its Influence of Computer Science : Richard Stallman
: Linus Torvalds :
Larry Wall :
John K. Ousterhout :
CTSS : Multix OS Unix
History : Unix shell history :
VI editor :
History of pipes concept :
Solaris : MS DOS
: Programming Languages History :
PL/1 : Simula 67 :
C :
History of GCC development :
Scripting Languages :
Perl history :
OS History : Mail :
DNS : SSH
: CPU Instruction Sets :
SPARC systems 1987-2006 :
Norton Commander :
Norton Utilities :
Norton Ghost :
Frontpage history :
Malware Defense History :
GNU Screen :
OSS early history
Classic books:
The Peter
Principle : Parkinson
Law : 1984 :
The Mythical Man-Month :
How to Solve It by George Polya :
The Art of Computer Programming :
The Elements of Programming Style :
The Unix Hater’s Handbook :
The Jargon file :
The True Believer :
Programming Pearls :
The Good Soldier Svejk :
The Power Elite
Most popular humor pages:
Manifest of the Softpanorama IT Slacker Society :
Ten Commandments
of the IT Slackers Society : Computer Humor Collection
: BSD Logo Story :
The Cuckoo's Egg :
IT Slang : C++ Humor
: ARE YOU A BBS ADDICT? :
The Perl Purity Test :
Object oriented programmers of all nations
: Financial Humor :
Financial Humor Bulletin,
2008 : Financial
Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related
Humor : Programming Language Humor :
Goldman Sachs related humor :
Greenspan humor : C Humor :
Scripting Humor :
Real Programmers Humor :
Web Humor : GPL-related Humor
: OFM Humor :
Politically Incorrect Humor :
IDS Humor :
"Linux Sucks" Humor : Russian
Musical Humor : Best Russian Programmer
Humor : Microsoft plans to buy Catholic Church
: Richard Stallman Related Humor :
Admin Humor : Perl-related
Humor : Linus Torvalds Related
humor : PseudoScience Related Humor :
Networking Humor :
Shell Humor :
Financial Humor Bulletin,
2011 : Financial
Humor Bulletin, 2012 :
Financial Humor Bulletin,
2013 : Java Humor : Software
Engineering Humor : Sun Solaris Related Humor :
Education Humor : IBM
Humor : Assembler-related Humor :
VIM Humor : Computer
Viruses Humor : Bright tomorrow is rescheduled
to a day after tomorrow : Classic Computer
Humor
The Last but not Least Technology is dominated by
two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt.
Ph.D
Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org
was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP)
without any remuneration. This document is an industrial compilation designed and created exclusively
for educational use and is distributed under the Softpanorama Content License.
Original materials copyright belong
to respective owners. Quotes are made for educational purposes only
in compliance with the fair use doctrine.
FAIR USE NOTICE This site contains
copyrighted material the use of which has not always been specifically
authorized by the copyright owner. We are making such material available
to advance understanding of computer science, IT technology, economic, scientific, and social
issues. We believe this constitutes a 'fair use' of any such
copyrighted material as provided by section 107 of the US Copyright Law according to which
such material can be distributed without profit exclusively for research and educational purposes.
This is a Spartan WHYFF (We Help You For Free)
site written by people for whom English is not a native language. Grammar and spelling errors should
be expected. The site contain some broken links as it develops like a living tree...
Disclaimer:
The statements, views and opinions presented on this web page are those of the author (or
referenced source) and are
not endorsed by, nor do they necessarily reflect, the opinions of the Softpanorama society. We do not warrant the correctness
of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be
tracked by Google please disable Javascript for this site. This site is perfectly usable without
Javascript.
Last modified:
March, 29, 2020