RStudio; R Basics
September 6, 2024
Posit Cloud (formerly RStudio Cloud) is a web service that delivers a browser-based experience similar to RStudio, the standard IDE for the R language.
For our course, we use Posit Cloud for the R programming component.
Environment Pane is where you can see the values of variables, data frames, and other objects that are currently stored in memory.
Type a <- 1
in Console, and then hit Enter.
tidyverse
R packages are collections of R functions, compiled code, and data that are combined in a structured format.
Several R packages come with numerous pre-built functions that can perform a wide range of data analysis tasks.
tidyverse
tidyverse
is a collection of R packages designed for data science that share an underlying design philosophy, grammar, and data structures.tidyverse
includes a lot of R packages, including ggplot2
, dplyr
, and tidyr
.
The tidyverse
packages work harmoniously together to make data manipulation, exploration, and visualization more.
install.packages("packageName")
install.packages("packageName")
.
tidyverse
, type and run the following command from R console:library(packageName)
library(packageName)
so that R package’s functions and data can be used.
tidyverse
, type and run the following commands from a R script:mpg
is the data.frame provided by the R package ggplot2
, one of the R pakcages in tidyverse
.
tidyverse
is installed, ggplot2
package is already installed.danl-101-lec-04-2024-0905.R
#
mark is R’s comment character.
*.R
files), #
indicates that the rest of the line is to be ignored.libr
in the RScript in RStudio and wait for a second.
A value is datum (literal) such as a number or text.
There are different types of values:
Sometimes you will hear variables referred to as objects.
Everything that is not a literal value, such as 10
, is an object.
What is going on here?
The shortcut for the assignment <-
is:
y <- x + 12
, it does the following:
<-
in the middle.x
and adds it to 12
).y
.