0
Why do we obtain five missing values from the following lines of code? x <- 1:5 x[NA]

Open 1 Answers 51 Views Technology

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

 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].

by (249k points)
...