Challenge - 5 Problems
Descriptive Statistics Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Calculate the mean and median of a numeric vector
What is the output of this R code that calculates the mean and median of the vector
c(2, 4, 6, 8, 10)?R Programming
x <- c(2, 4, 6, 8, 10) mean_x <- mean(x) median_x <- median(x) c(mean_x, median_x)
Attempts:
2 left
💡 Hint
Recall that mean is the average and median is the middle value when sorted.
✗ Incorrect
The mean of the vector (2+4+6+8+10)/5 is 6. The median is the middle value in the sorted vector, which is also 6.
❓ data_output
intermediate2:00remaining
Count the number of unique values in a factor
Given the factor
f <- factor(c('apple', 'banana', 'apple', 'orange', 'banana', 'banana')), what is the output of length(levels(f))?R Programming
f <- factor(c('apple', 'banana', 'apple', 'orange', 'banana', 'banana')) length(levels(f))
Attempts:
2 left
💡 Hint
Levels represent unique categories in a factor.
✗ Incorrect
The factor has three unique categories: 'apple', 'banana', and 'orange'. So, length(levels(f)) returns 3.
❓ visualization
advanced2:30remaining
Interpret a boxplot of numeric data
What does the boxplot of the numeric vector
c(1, 2, 2, 3, 4, 5, 6, 7, 8, 20) show about the data distribution?R Programming
x <- c(1, 2, 2, 3, 4, 5, 6, 7, 8, 20) boxplot(x, main = 'Boxplot of x')
Attempts:
2 left
💡 Hint
Look for the position of the median and any points outside whiskers.
✗ Incorrect
The value 20 is much larger than the rest, so it appears as an outlier on the right side, indicating right skewness.
🧠 Conceptual
advanced1:30remaining
Understanding variance and standard deviation
Which statement correctly describes the relationship between variance and standard deviation?
Attempts:
2 left
💡 Hint
Think about how variance and standard deviation relate mathematically.
✗ Incorrect
Variance measures spread as average squared deviation; standard deviation is its square root, giving spread in original units.
🔧 Debug
expert2:00remaining
Identify the error in calculating the mode
What error does this R code produce when trying to calculate the mode of vector
v <- c(1, 2, 2, 3, 4) using mode_v <- mode(v)?R Programming
v <- c(1, 2, 2, 3, 4) mode_v <- mode(v) mode_v
Attempts:
2 left
💡 Hint
Check what the mode() function returns in R base.
✗ Incorrect
In R, mode() returns the type of storage (like 'numeric'), not the statistical mode (most frequent value).