[R] Errors, driving me nuts

Matt Curcio matt.curcio.ri at gmail.com
Mon Aug 1 22:47:26 CEST 2011


Greetings all,
I am getting this error that is driving me nuts... (not a long trip, haha)

I have a set of files and in these files I want to calculate ttests on
rows 'compareA' and 'compareB' (these will change over time there I
want a variable here). Also these files are in many different
directories so I want a way filter out the junk...  Anyway I don't
believe that this is related to my errors but I mention it none the
less.

> files_to_test <- list.files (pattern = "kegg.combine")
> for (i in 1:length (files_to_test)) {
+    raw_data <- read.table (files_to_test[i], header=TRUE, sep=" ")
+    tmpA <- raw_data[,compareA]
+    tmpB <- raw_data[,compareB]
+    tt <- t.test (tmpA, tmpB, var.equal=TRUE)
+    tt_pvalue[i] <- tt$p.value
+ }
Error in tt_pvalue[i] <- tt$p.value : object 'tt_pvalue' not found
# I tried setting up a vector...
# as.vector(tt_pvalue, mode="any") ### but NO GO
> file.name = paste("ttest.results.", compareA, compareB, "")
> setwd(save_to)
> write.table(tt_pvalue, file=file.name, sep="\t" )
Error in inherits(x, "data.frame") : object 'tt_pvalue' not found
# No idea??

What is going wrong??
M


Matt Curcio
M: 401-316-5358
E: matt.curcio.ri at gmail.com



More information about the R-help mailing list