0
0
R Programmingprogramming~10 mins

Descriptive 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'
Amean
Bdata
Csum
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 <- [1](values)
Drag options to blanks, or click blank then click option'
Amedian
Bmean
Csum
Dmin
Attempts:
3 left
💡 Hint
Common Mistakes
Using mean instead of median.
Using sum or min which do not calculate the median.
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'
Ascore_vector
Bscore
Cscore_list
Dscores
Attempts:
3 left
💡 Hint
Common Mistakes
Using a variable name that does not exist like score.
Misspelling the variable name.
4fill in blank
hard

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

R Programming
stats <- list(mean = [1](data_vec), median = [2](data_vec))
Drag options to blanks, or click blank then click option'
Amean
Bmedian
Csum
Dsd
Attempts:
3 left
💡 Hint
Common Mistakes
Using sum or sd instead of mean or median.
Mixing the order of mean and median.
5fill in blank
hard

Fill all three blanks to create a named list with mean, median, and standard deviation of nums.

R Programming
summary_stats <- list([1] = [2](nums), median = [3](nums), sd = sd(nums))
Drag options to blanks, or click blank then click option'
Amean
Cmedian
Dsd
Attempts:
3 left
💡 Hint
Common Mistakes
Using median as the key instead of mean.
Mixing up the order of keys and functions.