0
0
R Programmingprogramming~5 mins

Handling missing values (drop_na, fill) in R Programming - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the drop_na() function do in R?
It removes rows from a data frame that contain any missing values (NA). This helps clean data by keeping only complete cases.
Click to reveal answer
beginner
How does fill() help with missing values in R?
The fill() function fills missing values (NA) in a column by carrying the last non-missing value forward or backward, useful for filling gaps in data.
Click to reveal answer
beginner
What package do drop_na() and fill() come from?
They are part of the tidyr package, which helps tidy and clean data in R.
Click to reveal answer
intermediate
What happens if you use drop_na() without any arguments?
It removes all rows that have any missing value in any column of the data frame.
Click to reveal answer
intermediate
How can you fill missing values only in specific columns using fill()?
You specify the column names inside fill(), like fill(data, column1, column2), to fill missing values only in those columns.
Click to reveal answer
What does drop_na() do by default?
ALeaves missing values unchanged
BFills missing values with zeros
CReplaces missing values with the mean
DRemoves rows with any missing values
Which package provides fill() and drop_na() functions?
Adplyr
Btidyr
Cggplot2
Dstringr
How does fill() fill missing values by default?
AWith the last non-missing value carried forward
BWith the next non-missing value
CWith zero
DWith the mean of the column
If you want to remove rows with missing values only in column age, how do you use drop_na()?
Afill(data, age)
Bdrop_na(data)
Cdrop_na(data, age)
Ddrop_na(data, all)
What is a common use case for fill()?
AFilling missing values in time series data by carrying last observation forward
BReplacing missing values with zeros
CRemoving all missing data
DSorting data alphabetically
Explain how drop_na() and fill() help handle missing values in R.
Think about removing vs filling missing data.
You got /3 concepts.
    Describe a situation where you would use fill() instead of drop_na().
    Consider when data loss is a problem.
    You got /3 concepts.