wave <- NULL
out_list <- list()
for (i in ifelse(zero_in, 0, 1):(length(waves)-ifelse(zero_in, 1, 0))) {
if (i %in% wave_numbers)
out_list[[i+1]] <- setNames(
cbind(waves[[i+1]][,input_names],
rep(i, nrow(waves[[i+1]]))), c(input_names, 'wave'))
}
If you set zero_in = FALSE and then add wave numbers up to the number of waves you have then you can't access wave[[i + 1]] since it doesn't exist e.g. if I have waves 1-10, and I set zero_in = FALSE and waves = 1:10, then it errors since it tries to access waves[[11]], which doesn't exist.
This is still causing an error:
If you set
zero_in = FALSE
and then add wave numbers up to the number of waves you have then you can't accesswave[[i + 1]]
since it doesn't exist e.g. if I have waves 1-10, and I setzero_in = FALSE
andwaves = 1:10
, then it errors since it tries to accesswaves[[11]]
, which doesn't exist.This is an attempt to fix this!
Cheers,
T