
Now that you understand what R Programming for Data Science is, the next crucial step for you would be to set up your working environment. You would now need two things-the R language itself and RStudio, which is the most proficient way of writing and running your R codes. Lets dive in towards the content for data science using r programming notes.

| Feature | R (The Engine) | RStudio (The Workbench) |
| Purpose | Core programming language and statistics engine | Integrated Development Environment (IDE) for R |
| Functionality | Performs calculations, modeling, and data manipulation | Provides code editor, file browser, plots, and debugging tools |
| Installation | Must be installed first | Installed after R to serve as an interface |
| User Experience | Basic command-line console | User-friendly, with multiple panes for coding, plots, and files |
| Who Uses It | Underlying tool used by all R projects | Preferred by data scientists for daily work |
Step 3: Verification
Console Check: Look at the bottom left pane (the Console) where it should display a message indicating which version of R it is running, e.g., "R version 4.4.1..."
Run Test Command: To make sure the environment is working, type in the Console:
print("Hello, Pw Skills!")
You are now set to start coding in R programming for data science.
| Pane Location | Pane Name | Purpose | Example Use Case |
| Top Left | Source Editor | Write and save R scripts (your reusable code files) | Create and save a data cleaning script |
| Bottom Left | Console | Type and run R commands, see immediate output | Run 2+2 or check summary(dataset) |
| Top Right | Environment/History | Track all variables, data objects, and past commands | View imported dataset or function list |
| Bottom Right | Multi-Function Pane (Files/Plots/Packages/Help/Viewer) | Manage files, visualize plots, install packages, get help | Plot with ggplot2 or install tidyverse |
Why it Matters:
If you don't set a working directory, R will save files to a random default location that will make them hard to find. We need to tell R where your project lives!How to Set It (Recommended Method):
It is best to make use of the Project Feature in RStudio.
Step-by-step Package Installation:
In the RStudio Console (bottom left pane), use install.packages() command to install: # This command downloads the package from CRAN and installs it install.packages("ggplot2")
Loading Package with library() Function:
# This command loads the package into your current R session's memory
library(ggplot2)
Pro Tip: While you will have to run install.packages() one time only for every computer, you shall be required to run library() every time you start a new R session or R Project and wish to work with that package.
RStudio also interfaces to do installations:
Under the Packages tab of the bottom right pane: