3 Overview of R and RStudio
What is R ?
- R, is a powerful language and environment for statistical computing and graphics.
- R is an open-source programming language, widely used among statisticians, data analysts, and researchers for data manipulation, calculation, and graphical display.
- R is not just a programming language, but also an environment for interactive statistical analysis.
- It was developed by Ross Ihaka and Robert Gentleman at the University of Auckland, New Zealand, and is currently maintained by the R Development Core Team.
- It is a GNU project and is freely available under the GNU General Public License.
- Packages: The R community is known for its active contributions in terms of packages. There are thousands of packages available in the Comprehensive R Archive Network (CRAN), covering various functions and applications.
- Platform Independent: R is available for various platforms such as Windows, MacOS, and Unix-like systems.
3.1 Installation and Setup
3.1.1 Install R
Download and install R from the Comprehensive R Archive Network CRAN and choose the relevant OS (Windows,mac,linux).
3.1.2 Install RStudio
RStudio is a recommended integrated development environment (IDE) for R. Download and install RStudio form POSIT and choose the relevant OS (Windows,mac,linux).
3.2 Overview of RStudio Panels
-
RStudio is a widely-used Integrated Development Environment (IDE) for R programming.
- RStudio’s design enhances the efficiency and user-friendliness of coding, testing, and data analysis in R.
- Its panels and features provide a comprehensive environment that caters to the needs of both novice and experienced R programmers.
- It features a user-friendly interface and is divided into several panels, each designed for specific tasks. Here’s a detailed overview of these panels.
Source Panel (Top-Left by Default)
Function
This panel is where you write and edit your R scripts and R Markdown documents.
Features
- Syntax highlighting for R code.
- Code completion and hinting.
- Ability to run code directly from the script.
Console Panel (Bottom-Left by Default)
Function
This is where R code is executed interactively.
Features
- Direct execution of R commands.
- Displays results of script execution.
- Keeps a history of your commands.
Environment/History Panel (Top-Right by Default)
Environment Tab
- Shows the current working dataset and variables in memory.
- Allows for inspection and management of data structures and variables.
History Tab
- Records all commands run in the Console.
- Enables re-running and insertion of previous commands into scripts.
Output/ Files/ Plots/ Packages/ Help/ Viewer Panel (Bottom-Right by Default)
Files Tab
- Manages project files and directories.
- Sets the working directory.
Plots Tab
- Displays graphs and charts.
- Allows for the export of plots.
Packages Tab
- Lists and manages R packages.
- Provides access to package documentation.
Help Tab
- Offers R documentation and help files.
- Useful for learning about R functions and packages.
Viewer Tab
- Displays local web content such as HTML files from R Markdown or Shiny apps.
Additional Features
- Toolbar: Quick access to common tasks like saving, loading, and running scripts.
- Customization: Ability to rearrange the layout of tabs and panes.
- Version Control: Integrated support for Git and SVN.