How to aggregate objects of different classes like Copula, lm in a single object while preserving their orginal classes and call them in a loop in R? -


i have few objects of class rvinematrix , copula families. need call every combination of 2 of these objects , compare them in function. of course can select combinations of 2 manually without using loop, easier through 2 "for" loops. aggregated objects in list , called them in 2 loops elements of list, realised in way classes changed "list".

allcopula=list(rvm1,rvm2, rvm3,rvm4)   (ic in 1:size(allcopula)[2]){ (ic2 in 1:size(allcopula)[2]){ testtable[ic,ic2]<- testcopula(desingdata,allcopula[ic],allcopula[ic2]) } } 

any appropriated. thanks.

list should preserve original classes, can see in example code:

> require(xts) > test <- xts(na, sys.date()) > vec1 <- seq(1:10) > typeof(test) [1] "logical" > typeof(vec1) [1] "integer" > l <- list(test, vec1) > typeof(l) [1] "list" > typeof(l[1]) [1] "list" > typeof(l[[1]]) [1] "logical" > typeof(l[[2]]) 

hence, have right element list in loop, try double brackets [[]].


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -