# A function to calculate the circumference of a circle
circumference <- function(r) {
2 * pi * r
}
# Call the function with a radius of 5
circumference(5)Glossary
Plain-language definitions of programming and R terms you’ll encounter regularly.
A
Argument
A value you pass into a function to control what it does.
Assignment
Putting a value into a variable, usually with <- in R.
B
Bug
A mistake where code runs but gives the wrong result.
C
Character (string)
Text in quotes, used for labels, IDs, and names.
Comment
A note starting with # that R ignores when code runs.
Console
The RStudio panel where command output appears.
D
Data frame
A table with rows and columns, where each column is a vector.
Debugging
The process of finding and fixing mistakes in code.
E
Error
A message that means R could not run your code.
F
Function
A reusable block of code that does a specific task.
I
IDE
An app for coding and running code, such as RStudio.
Import
Bring data, functions, or packages into R so you can use them in your session. For example library(tidyverse) imports the tidyverse package, and read_csv("data.csv") imports a CSV file into R.
Input
Data or values you give to R.
Install
Add a package to your computer so you can load it into R later. For example, install.packages("tidyverse") installs the tidyverse package. You only need to install a package once, but you must load it with library() in every new R session.
Integer
A whole number with no decimal part, such as 1 or 56.
L
Library
In R, another name for a package. In some contexts, it can also mean the folder where packages are installed.
Logical
A value that is either TRUE or FALSE.
N
NA
R’s marker for a missing value (“Not Available”).
Numeric
A number type that can include decimals.
O
Object
Anything you store in R, such as a vector, table, plot, or function result. Variables are objects with names.
Output
What R returns after running code, such as values, tables, plots, or messages.
P
Package
A collection of extra functions that extends base R, such as tidyverse. Also called a library.
Pipe (%>%)
Passes output from one step directly into the next step. This is the tidyverse version of the pipe.
A pipe lets R read the code from left to right:
c(7.438, 1.256) %>% round(1)
First it makes the numbers 7.438 and 1.256, then it sends them into round(1) so both are rounded to 1 decimal place. The output is 7.4 and 1.3.
R
Return value
The value a function gives back after it runs.
S
Script
A saved code file (for example .R or .qmd) you can rerun later.
Syntax
The grammar rules for writing valid code.
T
Terminal
The RStudio panel for operating system commands, not R commands.
Tibble
A modern tidyverse version of a data frame.
V
Variable
A named container that stores a value for reuse. Also called an object in R.
Vector
A sequence of values of the same type. For example v <- c(10, 20, 30) is a vector called v containing the integers 10, 20, and 30.
W
Warning
A message that code ran, but something may be suspicious.