I'm not sure is this correct, but maybe you are looking for something like this:
test<-function(){ permuted.Qtot<-permn(data$Qtot) n<-length(permuted.Qtot) correlation<-rep(NA,n) for(i in 1:n){ correlation[i]<-cor(data$Itot,permuted.Qtot[[i]])} p<-sum(correlation>=cor(data$Qtot,data$Itot))/n print(paste("P-value:", round(p,5)),quote=F) } test() -- Mi³ego dnia [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.