373 Midterm 1 R Functions

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/19

encourage image

There's no tags or description

Looks like no tags are added yet.

20 Terms

1
New cards

What does library() do?

Loads a package so its functions are available.

2
New cards

What does read_csv() do?

Reads a CSV file into a tibble; columns may be imported as text.

3
New cards

What do dim(), names(), glimpse(), head(), and summary() do?

Inspect dimensions, column names, structure, first rows, and summaries.

4
New cards

What does the |> pipe do?

Passes the left-hand result as the first argument to the next function.

5
New cards

What does <- do?

Assigns a result to an object, such as x <- 5.

6
New cards

What does filter() do?

Keeps rows matching a condition and drops rows that don't match.

7
New cards

What does select() do?

Keeps chosen columns; filter() keeps chosen rows.

8
New cards

What does count() do?

Counts observations for each combination of specified variable values.

9
New cards

What does mutate() do?

Creates or changes columns; use <- to save a changed result.

10
New cards

What does summarize() do?

Calculates summary statistics, often reducing rows to one per group.

11
New cards

What does group_by() do?

Makes subsequent operations, like summarize(), run separately by group.

12
New cards

What do arrange() and desc() do?

arrange() sorts rows; desc() makes sorting descending.

13
New cards

What does case_match() do?

Replaces specified values with new values; unmatched values need consideration.

14
New cards

What does as.numeric() do with unconvertible text?

Returns NA and usually gives a warning.

15
New cards

What does factor(levels = …, ordered = TRUE) do?

Creates an ordered categorical variable with specified levels.

16
New cards

What does mean(x, na.rm = TRUE) do?

Calculates the mean while excluding missing NA values.

17
New cards

What happens if mean(x) contains NA?

The result is NA unless missing values are removed.

18
New cards

What does sum(is.na(x)) count?

The number of missing values in x.

19
New cards

What does %in% do?

Tests whether each value belongs to a specified set of values.

20
New cards

What does n() count inside summarize()?

The number of rows in the current group, including rows with missing values.