Stat 542 exam 2 notes

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.

Last updated 4:37 AM on 3/27/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

20 Terms

1
New cards

Wide format

“Spreadsheet style”

Each row is a country, columns represent HIV values over a series of years

Better for viewing

Easier to create variables that compare response values across time periods

2
New cards

Long format

Each row is a different country-year combination

Each row represents only one distinct observation

Better for data analysis

Easier to add new variables or combine info in multiple tables

3
New cards

Tidy data

Array of rows and columns

Rows (items/case) are a specific, unique, and similar sort of thing

Column (variables) each have the same sort of value for each row

4
New cards

pivot_wider

Long → wide

Value_from

  • name of the variable in the narrow format to be divided up into multiple variables in the resulting wide format.

Names_from

  • name of the variable in the narrow format that identifies, for each case, which column in the wide format will receive the value

5
New cards

pivot_longer

wide → long

names_to

  • defines variables from the wide form that will become the categorical levels in the narrow form.

values_to

  • the variable that is to hold the values in the variables being gathered – it should reflect what those values actually represent

6
New cards

list-columns

A column where each cell contains an entire mini dataset instead of a single value.

Each row is a group (i.e. subjects)

A variable of type list

7
New cards

nest function

Turns a long dataset into one row per group, with the remaining data packed into a tibble in a list-column.

‘unnest’ converts nested list back into numeric or ungrouped data

Example:

Before

subject time score

A 1 10

A 2 12

B 1 8

After

subject data

A <tibble of A’s rows>

B <tibble of B’s rows>

8
New cards

pull function

Extract a list-column

9
New cards

map function

Apply a function to each element of a list

Use map with pull to get a specific measured variable

Use the result of that (a list) wtih map to perform calculations on this list

10
New cards

Native R data file format

.rda or .RData

Write: saveRDS

Read: readRDS

11
New cards

packages for reading files

readxl: Excel

googlesheets4: google sheets

dybplyr/DBI: relational databases on remote servers

readr: .csv files

rvest: HTML tables

read.csv (base R)

readr::read_csv

12
New cards

reading HTML files

rvest converts HTML to an R structure, then convert the HTML tables to R data tables

read_html: produces a list containing tables from the webpage

purrr:pluck: extracts any table from the list, can be stores as tibble

13
New cards

data cleaning: strings and numbers

parse_number: takes a character string and translates into numeric value

parse_character: takes number value/column and converts into character

14
New cards

Dates

Usually need to convert from character strings to date type

lubridate package

‘Date’ and ‘dttm’ (date-time) values

‘interval’ function values differences in date/time

‘hour’, ‘month’ functions extracts parts of variables that are stores as dates or times

15
New cards

Factors/strings

Factor: objects containing levels of a categorical variable

  • Allows custom ordering (fct_relevel)

readr::read_csv reads character strings by defailt, not factors

‘forcats’ package has tools for wrangling factor data

16
New cards

Vectorized operations

Basically like a for loop

Take vector as input, perform an operation on every element, return vector as output

17
New cards

map functions

Iteratively apply an R function to each element of a vector

map: collection of outputs stored as a list

map_dbl: numeric vectir

map_lgl, map_int, map_chr: logical, int, character

map_dfr: collects results into data frame

Base R: lapply, tapply

18
New cards

across function

Apply a function across columns

Used with summarize, mutate

‘where’ and ‘is.numeric’

19
New cards

iteration over subgroups

‘group_modify’ applies functions to subgroups of a data frame

Define groups with ‘group_by’

20
New cards

Animation plots

gganimate

transition_time: continuous, specify the name of the variable that is changing with the frames

transition_states: discrete, if the plot is changing over levels of a discrete variable, this will specify the name of this discrete variable

Explore top notes

note
IGCSE Science - Biology: Nutrition
Updated 1269d ago
0.0(0)
note
Chapter 8 and 13 Vocabulary
Updated 1249d ago
0.0(0)
note
Energy Sources
Updated 1318d ago
0.0(0)
note
Philosophy: Epistemology
Updated 1270d ago
0.0(0)
note
ap bio unit 3
Updated 493d ago
0.0(0)
note
Chapter 11: Ecology
Updated 1078d ago
0.0(0)
note
Iliad Summary
Updated 1199d ago
0.0(0)
note
IGCSE Science - Biology: Nutrition
Updated 1269d ago
0.0(0)
note
Chapter 8 and 13 Vocabulary
Updated 1249d ago
0.0(0)
note
Energy Sources
Updated 1318d ago
0.0(0)
note
Philosophy: Epistemology
Updated 1270d ago
0.0(0)
note
ap bio unit 3
Updated 493d ago
0.0(0)
note
Chapter 11: Ecology
Updated 1078d ago
0.0(0)
note
Iliad Summary
Updated 1199d ago
0.0(0)

Explore top flashcards

flashcards
AP Psychology: Unit 6
70
Updated 17d ago
0.0(0)
flashcards
Modern Art
33
Updated 178d ago
0.0(0)
flashcards
non fermenting GN
45
Updated 1136d ago
0.0(0)
flashcards
psyc367- neuroscience: test 1
83
Updated 28d ago
0.0(0)
flashcards
Imperialism Quiz
21
Updated 1046d ago
0.0(0)
flashcards
Organelles
26
Updated 1250d ago
0.0(0)
flashcards
AP Psychology: Unit 6
70
Updated 17d ago
0.0(0)
flashcards
Modern Art
33
Updated 178d ago
0.0(0)
flashcards
non fermenting GN
45
Updated 1136d ago
0.0(0)
flashcards
psyc367- neuroscience: test 1
83
Updated 28d ago
0.0(0)
flashcards
Imperialism Quiz
21
Updated 1046d ago
0.0(0)
flashcards
Organelles
26
Updated 1250d ago
0.0(0)