robert.koellner
2013-Mar-14 11:08 UTC
[R] error: object of type 'closure' is not subsettable
Hi all, when i run this script:>read.table("Angelika.txt",header=T,sep="\t") >mytable=read.table("Angelika.txt",header=T,sep="\t") >for ( dye in c("A","B","C","F","G","K","L","M"))+ { + for (cond in 1:8) + { + measurement = table[mytable[,"bed"]==cond & mytable[,"dye"]==dye,"differenz"] + print(median(measurement)) + wilcox.test(measurement,mu=0) + } + } I get the error massage: error in table[mytable[, "bed"] == cond & mytable[, "dye"] == dye, "differenz"] : object of type 'closure' is not subsettable I am beginner with R, so I didn?t write this script myself. What is meant with 'closure' and how can I solve this? I started also another script (this time by myself) but for sure it is much more work to do this in comparison to the other script: # con (condition) #1: Standart-hoch #2: Standart-niedrig #3: Standart-mittel #4: Ringe-hoch #5: Ringe-niedrig #6: Ringe-mittel #7: Fitness-hoch #8: Fitness-niedrig # dye #A: Hoechst42 #B: Hoechst80 #C: Vio #D: Vibrant Orange gating 1 #E: Vibrant Orange gating 2 #F: NID APC #G: NID PerCP #H: DraQ #I: Syber Green 1000 #J: Syber Green 2000 #K: Syber Green 5000 #L: Acridin Orange FITC #M: Acridin Orange PerCP #Standart Hoch & Hoechst42, Hoechst80, Vio, NID APC, NID PerCP, Syber Green 5000, Acridin Orange FITC, Acridin Orange PerCP aa=mytable[mytable[,"con"]==1& mytable[,"dye"]=="A","differenz"] ab=mytable[mytable[,"con"]==1& mytable[,"dye"]=="B","differenz"] ac=mytable[mytable[,"con"]==1& mytable[,"dye"]=="C","differenz"] ad=mytable[mytable[,"con"]==1& mytable[,"dye"]=="F","differenz"] ae=mytable[mytable[,"con"]==1& mytable[,"dye"]=="G","differenz"] af=mytable[mytable[,"con"]==1& mytable[,"dye"]=="K","differenz"] ag=mytable[mytable[,"con"]==1& mytable[,"dye"]=="L","differenz"] ah=mytable[mytable[,"con"]==1& mytable[,"dye"]=="M","differenz"] wilcox.test(aa,mu=0) wilcox.test(ab,mu=0)... but here I have to do a single test for each condition and dye...and thats is much (each condition has to be tested with these dyes) Table with data attached: Angelika.txt <http://r.789695.n4.nabble.com/file/n4661305/Angelika.txt> It would be great if someone could help me. Thanks and greetings Robert -- View this message in context: http://r.789695.n4.nabble.com/error-object-of-type-closure-is-not-subsettable-tp4661305.html Sent from the R help mailing list archive at Nabble.com.
robert.koellner
2013-Mar-14 12:05 UTC
[R] error: object of type 'closure' is not subsettable
Edit: OK I got it>for ( dye in c("A","B","C","F","G","K","L","M"))+ { + for (cond in 1:8) + { + measurement = *my*table[mytable[,"bed"]==cond & mytable[,"dye"]==dye,"differenz"] + print(median(measurement)) + wilcox.test(measurement,mu=0) + } + } But now I get new error massages: Error in wilcox.test.default(measurement, mu = 0) : not enough (finite) 'x' observations In addition: There were 11 warnings (use warnings() to see them)> warnings()Warning messages: 1: In wilcox.test.default(measurement, mu = 0) : cannot compute exact p-value with ties 2: In wilcox.test.default(measurement, mu = 0) : cannot compute exact p-value with zeroes 3: In wilcox.test.default(measurement, mu = 0) : cannot compute exact p-value with zeroes 4: In wilcox.test.default(measurement, mu = 0) : cannot compute exact p-value with ties 5: In wilcox.test.default(measurement, mu = 0) : cannot compute exact p-value with ties 6: In wilcox.test.default(measurement, mu = 0) : cannot compute exact p-value with ties 7: In wilcox.test.default(measurement, mu = 0) : cannot compute exact p-value with zeroes 8: In wilcox.test.default(measurement, mu = 0) : cannot compute exact p-value with zeroes 9: In wilcox.test.default(measurement, mu = 0) : cannot compute exact p-value with ties 10: In wilcox.test.default(measurement, mu = 0) : cannot compute exact p-value with ties 11: In wilcox.test.default(measurement, mu = 0) : cannot compute exact p-value with ties What does this mean? OK can?t compute with zeros, but why? The test should compare the mediandifference to 0 and if the values are 0 it should be 1, or not? And what means 'cannot compute exact p-value with ties'? Greetings Robert -- View this message in context: http://r.789695.n4.nabble.com/error-object-of-type-closure-is-not-subsettable-tp4661305p4661316.html Sent from the R help mailing list archive at Nabble.com.