Entering edit mode
5.3 years ago
Kai_Qi
▴
130
Hello Everyone:
I have got a data frame after analyze my RNA seq data. Now I want to run a binomial test using data from two columns (eg, column Min and column Max, for example the first number of column Min will be used together with first number of column Max).
My code is binom.test(mydata_CRep1$Min, mydata_CRep1$Max, 1/3.5, alternative = "lower")
And it gives me error like
"Error in binom.test(mydata_CRep1$min..E1I..IE2...I._CRep1, mydata_CRep1$max..E1I...IE2...I., :
incorrect length of 'x'"
Can someone helps me figure out how should I write the code correctly?
Thanks,
Cai
The error message is telling you that parameter x is not what the function is expecting. Have you checked that the data you're passing to the function corresponds to what it expects as written in the doc? If you want to iterate over rows of a data frame, you should use one of the functions of the apply family. Or maybe you're using the wrong test.
Thank you for your reply. I checked the columns and the number looks right. I also wrote a function to do it:
the results is:
What I followed is the paper : https://genome.cshlp.org/content/24/11/1774.full.pdf+html page 10 P-value(binomial{M = min(#E1I, #IE2, #I), N = min(#E1I, #IE2, #I) + max(#E1I, #IE2, #I), P = 1/3.5, alternative = lower }) $ 0.05