function with vector R - argument is of length zero
问题 Wrote this function lockdown_func(beta.hat_func) . First thing is: I get an error "argument is of length zero". Second thing is: when I compute it without the date indices, it doesn't change the value as it should, output vector contains same value for every indices. date= c(seq(from=30, to=165)) beta.hat_func <- c(rep(x = beta.hat, times = 135)) beta.hat <- beta0[which.min(SSE)] #implement function for modeling lockdown_func <- function(beta.hat_func,l){ h=beta.hat_func { for(i in 1:length(h