You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
?mean
#Get help of a particular function.
help.search(‘weighted mean’)
#Search the help files for a word or phrase.
help(package = ‘dplyr’)
#Find help for a package.
More about an object
str(iris)
#Get a summary of an object’s structure.
class(iris)
#Find the class an object belongs to.
getwd()
#Find the current working directory (where inputs are found and outputs are sent).
setwd(‘C://file/path’)
#Change the current working directory
Use projects in RStudio to set the working directory to the folder you are working in.
install.packages(‘dplyr’)
#Download and install a package from CRAN.
library(dplyr)
#Load the package into the session, making all its functions available to use.
dplyr::select
#Use a particular function from a package. data(iris) Load a built-in dataset into the environment
paste(x, y, sep = ' ')
#Join multiple vectors together.
paste(x, collapse = ' ')
#Join elements of a vector together.
grep(pattern, x)
#Find regular expression matches in x.
gsub(pattern, replace, x)
#Replace matches in x with a string.
toupper(x)
#Convert to uppercase.
tolower(x)
#Convert to lowercase.
nchar(x)
#Number of characters in a string
factor(x)
#Turn a vector into a factor. Can set the levels of the factor and the order.
cut(x, breaks = 4)
#Turn a numeric vector into a factor but ‘cutting’ into sections.