search for: list_blah

Displaying 1 result from an estimated 1 matches for "list_blah".

Did you mean: list_bl
2009 Oct 15
1
performing function on lists where each element is a data frame
...I can do this fine for an individual list element: > weighted.mean(list[[1999]]$H,list[[1999]]$N) [1] 0.4456403 or even: > weighted.mean(list[[i]]$H,list[[i]]$N) [1] 0.5992683 but when I try and apply it in a lopp to give me back the weighted mean for each list element, I get errors: > list_blah<-matrix(1:2000) > for(i in 1:2000){ + list_blah[i]=weighted.mean(list[[i]]$H,list[[i]]$N)} Error in list[[i]] : subscript out of bounds I am clearly not understanding a basic syntax issue, and I am not overly skilled at using loops. I have also tried using lapply instead of a for loop, with...