1. R has how many atomic classes of objects?
Explanation: The most basic type of R object is a vector.
2. Point out the correct statement?
a) Empty vectors can be created with the vector() function
b) A sequence is represented as a vector but can contain objects of different classes
c) “raw” objects are commonly used directly in data analysis
d) The value NaN represents undefined value
Explanation: A vector can only contain objects of the same class.
3. Numbers in R are generally treated as _______ precision real numbers.
Explanation: This means that even if you see a number like “1” or “2” in R, which you might think of as integers, they are likely represented behind the scenes as numeric objects something like “1.00” or “2.00”.
4. If you explicitly want an integer, you need to specify the _____ suffix.
Explanation: Entering 1 in R gives you a numeric object; entering 1L explicitly gives you an integer object.
5. Point out the correct statement?
a) The value NaN represents undefined value
b) Number Inf represents infinity in R
c) NaN can also be thought of as a missing value
d) “raw” objects are commonly used directly in data analysis
Explanation: This allows us to represent entities like 1 / 0.
6. Attributes of an object (if any) can be accessed using the ______ function.
Explanation: Not all R objects contain attributes, in which case the attributes() function returns NULL.
7. R objects can have attributes, which are like ________ for the object.
Explanation: These metadata can be very useful in that they help to describe the object.
8. Which of the following can be considered as object attribute?
d) all of the mentioned
Explanation: All objects in R have an Attribute list.
9. What will be the output of the following R code?
> x <- vector("numeric", length = 10)
b) 0 0 0 0 0 0 0 0 0 0
Explanation: You can also use the vector() function to initialize vectors.
10. The ________ function can be used to create vectors of objects by concatenating things together.
Explanation: The simplest such structure is the numeric vector, which is a single entity consisting of an ordered collection of numbers.