Reputation: 1111
I am reviewing multiple imputations methods in R, and I came across a fundamental yet important question. In the script below, what purpose does the number 7 serve in data[4:10, 3] <- rep(NA, 7)? Is it telling R to repeat NA seven times?
library(mice)
library(Amelia)
library(mi)
library(missForest)
library(Hmisc)
library(mi)
data <- airquality
data[4:10, 3] <- rep(NA, 7) # rows 4 through 10, third column, make it NA
data[1:5, 4] <- NA # rows 1 through 5, fourth column, make it NA
Upvotes: 0
Views: 77
Reputation: 564
Yes.
> rep(NA, 3)
# [1] NA NA NA
>rep(NA, 7)
# [1] NA NA NA NA NA NA NA
Upvotes: 2