0
0
R Programmingprogramming~10 mins

Summary statistics in R Programming - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to calculate the mean of the numeric vector data.

R Programming
mean_value <- mean([1])
Drag options to blanks, or click blank then click option'
Asum
Bmean
Cdata
Dmedian
Attempts:
3 left
💡 Hint
Common Mistakes
Putting the function name inside itself instead of the data vector.
Using sum or median instead of the data vector.
2fill in blank
medium

Complete the code to calculate the median of the numeric vector values.

R Programming
median_value <- median([1])
Drag options to blanks, or click blank then click option'
Amedian
Bvalues
Cmean
Dlength
Attempts:
3 left
💡 Hint
Common Mistakes
Using the function name median inside itself instead of the data vector.
Using mean or length instead of the data vector.
3fill in blank
hard

Fix the error in the code to calculate the standard deviation of scores.

R Programming
std_dev <- sd([1])
Drag options to blanks, or click blank then click option'
Avar
Bsd
Cmean
Dscores
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the function name sd instead of the data vector.
Using mean or var instead of the data vector.
4fill in blank
hard

Fill both blanks to create a named list with mean and median of numbers.

R Programming
summary_stats <- list(mean = [1], median = [2])
Drag options to blanks, or click blank then click option'
Amean(numbers)
Bmedian(numbers)
Cmean
Dnumbers
Attempts:
3 left
💡 Hint
Common Mistakes
Putting the function names mean or median without calling them.
Using the vector numbers directly instead of calculating the statistics.
5fill in blank
hard

Fill all three blanks to create a data frame with mean, median, and standard deviation of data_vec.

R Programming
stats_df <- data.frame(
  Mean = [1],
  Median = [2],
  SD = [3]
)
Drag options to blanks, or click blank then click option'
Amean(data_vec)
Bmedian(data_vec)
Csd(data_vec)
Ddata_vec
Attempts:
3 left
💡 Hint
Common Mistakes
Using the vector data_vec directly instead of calculating statistics.
Mixing up the order of mean, median, and standard deviation.