Complete the code to create a vector of numbers in R.
numbers <- c([1])In R, the c() function combines values into a vector. Values must be separated by commas.
Complete the code to calculate the mean of a numeric vector in R.
mean_value <- mean([1])The mean() function calculates the average of the values in the vector named numbers.
Fix the error in the code to create a data frame with columns 'age' and 'score'.
df <- data.frame(age = c(25, 30, 22), score = [1](80, 90, 85))
The c() function combines values into a vector, which is needed for the 'score' column.
Fill both blanks to create a subset of 'df' where age is greater than 23.
subset_df <- df[df$[1] > [2], ]
We select rows where the 'age' column is greater than 23 using df$age > 23.
Fill all three blanks to calculate the correlation between 'age' and 'score' in 'df'.
correlation <- cor(df$[1], df$[2], method = [3])
The cor() function calculates correlation between two vectors. We use 'age' and 'score' columns and the 'pearson' method.