MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which of the following operators cannot be used to extract elements from atomic vectors?
A
$
B
[[
C
[
D
None of the above
Explanation: 

Detailed explanation-1: -Such an error is produced by the R compiler when we try to get an element of an atomic vector by using the $ operator. An atomic vector is simply a 1-dimensional object containing data created with the help of c() and vector() functions. R doesn’t allow us to access elements of an atomic vector using the $ symbol.

Detailed explanation-2: -R has six basic (’atomic’) vector types: logical, integer, real, complex, string (or character) and raw.

Detailed explanation-3: -Vectors are the most basic R data objects and there are six types of atomic vectors. They are logical, integer, double, complex, character and raw.

Detailed explanation-4: -vector : An atomic vector is either logical, integer, numeric, complex, character or raw and can have any attributes except a dimension attribute (like matrices). I.e., a factor is an atomic vector, but a matrix or NULL are not. In short, this is basically equivalent to is. atomic(x) && !is.

There is 1 question to complete.