0
0
R Programmingprogramming~20 mins

Summary statistics in R Programming - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Summary Statistics Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
Output of summary statistics with NA values
What is the output of the following R code that calculates summary statistics on a vector with missing values?
R Programming
x <- c(5, 7, NA, 3, 9, NA, 4)
summary(x)
AMin. : 3.0 1st Qu.: 4.0 Median : 5.0 Mean : 5.6 3rd Qu.: 7.0 Max. : 9.0 NA's : 2
BMin. : 3.0 1st Qu.: 4.0 Median : 5.0 Mean : NA 3rd Qu.: 7.0 Max. : 9.0
CMin. : 3.0 1st Qu.: 4.0 Median : 5.0 Mean : 5.6 3rd Qu.: 7.0 Max. : 9.0
DMin. : NA 1st Qu.: NA Median : NA Mean : NA 3rd Qu.: NA Max. : NA
Attempts:
2 left
💡 Hint
Remember that summary() shows count of NA values separately.
data_output
intermediate
1:30remaining
Number of rows after filtering by summary statistics
Given a data frame df with a numeric column 'score', how many rows remain after filtering out rows where 'score' is below the median?
R Programming
df <- data.frame(score = c(10, 20, 15, 30, 25))
median_score <- median(df$score)
df_filtered <- df[df$score >= median_score, ]
nrow(df_filtered)
A3
B2
C4
D5
Attempts:
2 left
💡 Hint
Calculate the median and count how many values are equal or above it.
visualization
advanced
2:00remaining
Interpreting boxplot summary statistics
Which statement correctly describes the boxplot summary statistics shown for a numeric vector in R?
R Programming
x <- c(2, 4, 5, 6, 8, 9, 10, 11, 12)
boxplot(x)
AThe median is 10, and the IQR is 6.
BThe median is 8, and the interquartile range (IQR) is 10.
CThe median is 8, and the IQR is 6.
DThe median is 10, and the IQR is 10.
Attempts:
2 left
💡 Hint
Recall median is the middle value; IQR is Q3 minus Q1.
🧠 Conceptual
advanced
1:30remaining
Understanding skewness from summary statistics
If a numeric dataset has mean > median > mode, what can you infer about its skewness?
AThe distribution is negatively skewed (left-skewed).
BThe distribution is positively skewed (right-skewed).
CThe distribution is symmetric.
DThe distribution is bimodal.
Attempts:
2 left
💡 Hint
Think about how mean, median, and mode relate in skewed data.
🔧 Debug
expert
2:00remaining
Identify the error in summary statistics calculation
What error will this R code produce when calculating the mean of a data frame column?
R Programming
df <- data.frame(a = c(1, 2, 3), b = c('x', 'y', 'z'))
mean(df)
ANo error; returns mean of column 'a'
BError in mean.default(df) : 'trim' must be numeric of length one
CError in mean.default(df) : argument is not numeric or logical: returning NA
DError in mean.default(df) : 'x' must be numeric
Attempts:
2 left
💡 Hint
mean() expects a numeric vector, not a data frame.