Complete the code to create a numeric vector in R.
numbers <- c(1, 2, 3, [1])
The vector should contain numeric values. Using 4 (without quotes) keeps it numeric.
Complete the code to check the data type of the variable 'x'.
x <- 10 class([1])
Use the variable name 'x' inside the class() function to check its data type.
Fix the error in the code to convert a character vector to numeric.
chars <- c("1", "2", "3") numbers <- as.[1](chars)
Use as.numeric() to convert character values that represent numbers into numeric type.
Fill both blanks to create a logical vector and check its type.
flags <- c(TRUE, FALSE, TRUE) type <- class([1]) print([2])
Use the variable 'flags' to get its class, then print the 'type' variable.
Fill all three blanks to create a factor and check its levels.
colors <- factor(c("red", "blue", "red")) [1] <- levels([2]) print([3])
Create a variable to store levels, get levels of 'colors', then print that variable.
