Quiz 8 Flashcards
What does the unique function do in R?
Tells you what all of the unique values are in a particular column
ex. unique(ldt_data$RT_speed)
What does the “filter” function do?
Selects the rows that match given criteria
ex. filter(ldt_data,RT_speed==“fast”)
What does == do in R?
(two equals signs)
tests/checks whether something is equal
ex. x==y will test if they are equal, say “TRUE” or “FALSE”
How do you eliminate rows in a column that have a specific value?
filter(ldt_data, Length_type != “mid”)
How can you get R to convert what it is considering characters to be seen as numbers (ex. if your numeric data has quotes around it)
ex. x<- (“10”, 20, 30)—will read all as characters
as.numeric(x) (now can run numeric functions)
How can you combine multiple conditions when filtering in R?
use ‘&’ to separate conditions
ex. filter(ldt_data, RT_speed==“slow” & Length ==9)
What does the “mutate” function do?
create a new variable (“mutate” data frame)
How can you save a new data frame that has the changes made from a mutate operation?
can reassign variable ex. ldt_data
ldt_data<- mutate(ldt_data, Length_10= Length*10)
or, if not appending previous data, can save as new variable:
ex. new_length<-(ldt_data$Length*10)
What is the purpose of descriptive statistics?
- to make a summary of the data we have at hand
- to explore existing data for patterns
What are the types of data in descriptive statistics?
- nominal (values are names or labels)
- ordinal (nominal categories are ordered)
- interval (equal intervals on scale represent equal differences between the points on the scale)
- ratio (similar to interval ratios, but here a zero is meaningful, not arbitrary)
Describe nominal data
- values simply names or labels
- nominal variables represent the least precise and informative level of measurement in comparison to other data types
ex. speaker of a language can be: - “native” or “non-native”
- male or female
A doesn’t = B (vowel category: i, e, a, o, u)
Describe ordinal data
- dealing with ordinal variables when nominal categories are ordered
- ex. “likert scale”-> ‘strongly disagree->’disagree>’agree>’strongly agree’
- ex. vowel height: low—low-mid—high-mid—high
Describe interval data
- dealing with interval variables if equal intervals on the scale represent equal differences between the points on the scale
- ex. temperature (C or F)— 25C to 30C same as 20C to 25C (0C doesn’t mean no temperature)
- multiplication, division don’t make sense (20C not twice as warm as 10C)
- negative values possible
A+B, A-B (birth year 1985, 1978, 2005)
Describe ratio data
- ratio variables similar to interval, but zero is meaningful
- zero can mean absence of the thing being measured ex. 0 occurrences of word “aardvark” in a text
- multiplication and division make senes (book can have 2x as many “aardvark” references as another
- negative value not possible
A x B, A / B (vowel duration: 50, 49, 53, 60ms)
What is a pipe in tidyverse?
a special operator %>% to feed things to the next process
ex. df4<-ldt_data %>%
filter(Length>9) %>%
(takes whatever comes before it and passes it on to next step)