Section 1.12 Key Functions & Commands
The following functions, operators, and commands are introduced for the first time in this chapter and form the foundation for working in R.
-
<-(base R) β Assigns values to objects for later use. -
c()(base R) β Combines multiple values into a single vector. -
[](base R) β Indexes and subsets elements from vectors or data frames. -
$(base R) β Accesses or creates columns within a data frame. -
sqrt()(base R) β Computes square roots. -
round()(base R) β Rounds numeric values to a specified number of digits. -
class()(base R) β Identifies the data type (class) of an object. -
length()(base R) β Returns the number of elements in a vector. -
factor()(base R) β Converts character data into categorical (factor) variables. -
levels()(base R) β Displays the levels associated with a factor. -
data.frame()(base R) β Combines vectors into a tabular data structure. -
str()(base R) β Displays the internal structure and data types of a dataset. -
summary()(base R) β Produces descriptive summaries of variables in a dataset. -
colnames()(base R) β Displays or modifies column names of a data frame. -
read.csv()(base R) β Imports CSV files into R as data frames. -
install.packages()(base R) β Installs packages from CRAN. -
library()(base R) β Loads an installed package into the current R session. -
?function_name(base R) β Accesses built-in help documentation for a function.
