I'd like to use loop function in R with following code:
pc01 <- qcc(matrix(cbind(dta02[1:length(dta02)-1], dta02[2:length(dta02)]), ncol = 2), type = "R")
pc02 <- qcc(matrix(cbind(dta02[1:length(dta02)-1], dta02[2:length(dta02)]), ncol = 2), type = "R")
pc03 <- qcc(matrix(cbind(dta03[1:length(dta03)-1], dta03[2:length(dta03)]), ncol = 2), type = "R")
In order to make it easily, I used the 'function'
myqccF <- function(n)
{
qcc(matrix(cbind(n[1:length(n)-1], n[2:length(n)]), ncol = 2), type = "R")
}
and then, how do I make the loop using the function 'myqccF' like the following code?
qc01 <- myqccF(dta01)
qc02 <- myqccF(dta02)
qc03 <- myqccF(dta03)