0 votes
in Technology by (321k points)

Why do we obtain five missing values from the following lines of code?

x <- 1:5
x[NA]

R programming interview and answers

1 Answer

0 votes
by (321k points)

 NA is a logical type object and the logical vectors are reused to the equal length shared between vector and its subset. For example, x[NA] when iterated five times becomes x[NA, NA, NA, NA, NA].

...