0% found this document useful (0 votes)
5 views2 pages

Introduction to R and RStudio Basics

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Introduction to R and RStudio Basics

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Experiment 1: Introduction to R and RStudio

1. Introduction to Interface (R / RStudio)

R is a programming language used for statistical computing and graphics.

RStudio is an Integrated Development Environment (IDE) for R, which provides a user-friendly

interface.

RStudio Interface consists of:

- Source (Top-Left): For writing and saving scripts (.R files)

- Console (Bottom-Left): Direct command execution

- Environment/History (Top-Right): Shows variables and command history

- Files/Plots/Packages/Help (Bottom-Right): Access to files, plots, installed packages, and help

documents

2. Getting Started

To begin with RStudio:

- Launch RStudio after installation

- Use the Console to execute commands or the Source editor to write scripts

Basic R commands:

x <- 10

y <- 5

z <- x + y

print(z)

Vectors example:

numbers <- c(1, 2, 3, 4, 5)


mean(numbers)

3. Getting Help

To get help in R:

?mean # Opens help page for mean()

help(sd) # Help for standard deviation function

??regression # Search for related topics

example(mean) # Shows examples of how mean() works

[Link]("ggplot2")

library(ggplot2)

4. The Workspace

The workspace is the current R environment that includes all active variables and functions.

Useful commands:

ls() # List all objects

rm(x) # Remove variable x

rm(list = ls()) # Clear all objects

[Link]("my_workspace.RData") # Save current session

load("my_workspace.RData") # Load a saved session

You might also like