Hello, I am attempting to run a bootstrap on a data frame, but something is going wrong. I have 2 data frames: A B V1 V2 V3 V1 V2 V3 1 1 4 7 1 10 13 16 2 2 5 8 2 11 14 17 3 3 6 9 3 12 15 18
Over each iteration of the bootstrap, I would like to perform a t.test on the corresponding columns (i.e. t.test(A$V1,B$V1) and so on). I wrote a function that does this, and only keeps the p.values. However, I only want to run the bootstrap on B (I don't want to resample A, I just need it for the t.tests). Is this even possible? Here's the code I have so far, and the warning messages I get (The function works fine, its the boot command that's wrong somehow): boot.fun2<-function(A,B){ res1<-t.test(A$V1,B$V1) res2<-t.test(A$V2,B$V2) res3<-t.test(A$V3,B$V3) res.p<-list() res.p<-c(res1$p.value,res2$p.value,res3$p.value) res.p } boot(B,boot.fun2,R=1000) Error in var(x) : 'x' is empty In addition: Warning messages: 1: In A$V1 : $ operator is invalid for atomic vectors, returning NULL 2: In B$V2 : $ operator is invalid for atomic vectors, returning NULL 3: In is.na(x) : is.na() applied to non-(list or vector) of type 'NULL' 4: In mean.default(x) : argument is not numeric or logical: returning NA > -- View this message in context: http://www.nabble.com/Boot-warning-messages-tp18999810p18999810.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.