R Programming

Ace your homework & exams now with Quizwiz!

Pipe Operator

%>%. (means 'and then' so you can write next line of code) shift + Ctrl + M

Package

A collection of functions, data sets, and documentation bundled together. install.packages("ggplot2")

Variable

A container to store data values or information. age <- 30

Loop

A control structure that repeats a set of instructions until a condition is met. for (i in 1:5) { print(i) }

List

A data structure that can hold elements of different data types. my_list <- list(1, "Hello", TRUE)

Plot

A graphical representation of data. plot(x, y, type="scatter")

Vector

A one-dimensional data structure holding elements of the same data type. my_vector <- c(1, 2, 3, 4)

Function

A reusable block of code that performs a specific task. mean(my_vector)

Conditional

A statement that checks a condition and executes code accordingly. if (x > 10) { print("x is greater than 10") }

Data Frame

A two-dimensional data structure resembling a table with rows and columns. my_df <- data.frame(x=c(1,2,3), y=c("A","B","C"))

Matrix

A two-dimensional data structure with rows and columns. my_matrix <- matrix(1:9, nrow=3, ncol=3)

Term

Definition Example

Vectorization

Performing operations on entire vectors rather than individual elements. result_vector <- vector1 + vector2

Data Import/Export

Reading data from external sources or saving data to external files. read.csv("data.csv")

Data Types: Logical

TRUE, FALSE

Data Visualization

The graphical representation of data to aid in understanding patterns. library(ggplot2); ggplot(data=my_df, aes(x=x, y=y)) + geom_point()

Indexing

The process of accessing specific elements in a data structure. my_vector[3]

Data Manipulation

The process of transforming, cleaning, or organizing data for analysis. library(dplyr); filtered_data <- filter(data, age > 18)

Variable Name can be:

combination of letters, digits, period & underscore

Variables

used to store data with named locations that your programs can manipulate


Related study sets

Chapter 2 Test American Government

View Set

NURS 125: Prep U Chapter 12 Oncologic

View Set

RN Comprehensive Predictor Nursing -Study Guide

View Set

newsletters words 8 (heard but not used before)

View Set

Human Anatomy - Head and Neck Worksheet 4

View Set