last update: 2021-07-21

R as a garage

 

A garage has toolboxes and tools

What you will learn

 

  • Function tour
  • Using functions and getting help
  • R “Packages”
  • Finding, downloading and using packages

Function tour

 

Functions are tools that do work

The structure of an R function:

 

function_name(
argument_1 = value_1,
argument_2 = value_2,
…
)

Using functions and getting help

 

help(topic = ), e.g. help(topic = sd)

R “Packages”

 

Someone has probably created a tool (function) to solve your problem.

You just have to find the toolbox (R package) it is in.

Finding, downloading and using packages

Finding packages happens a variety of ways in practice. A package may be recommended to you, you might be told to use a particular package for a task or assignment, or you may discover it on the web.

 

install.packages("package_name") library("package_name")

Live coding

Â