Recall & Review
beginner
What is a character type in R?
A character type in R is used to store text or strings, like words or sentences, inside quotes.
Click to reveal answer
beginner
How do you create a character string in R?
You create a character string by putting text inside single or double quotes, for example: "hello" or 'world'.
Click to reveal answer
beginner
What function checks if a value is a character in R?
The function is.character() returns TRUE if the value is a character string, otherwise FALSE.
Click to reveal answer
beginner
How does R treat a single letter inside quotes?
R treats a single letter inside quotes as a character string of length one, not as a separate type.
Click to reveal answer
intermediate
What happens if you mix numbers and characters in a vector in R?
R converts all elements to character type because a vector must have elements of the same type.
Click to reveal answer
How do you create a character string in R?
✗ Incorrect
In R, character strings must be inside single or double quotes.
What does is.character("R") return?
✗ Incorrect
The value "R" is a character string, so is.character returns TRUE.
What type does R assign to c("a", 1, TRUE)?
✗ Incorrect
R converts all elements to character because vectors must have one type.
Which function checks if a variable is a character string?
✗ Incorrect
is.character() returns TRUE if the input is a character string.
What is the length of the character string "a" in R?
✗ Incorrect
A single character string has length 1 in R.
Explain how R handles character strings and how to create them.
Think about how you write words in R code.
You got /3 concepts.
Describe what happens when you mix characters and numbers in a vector in R.
Remember vectors need one type only.
You got /3 concepts.