Hi friends,
Does anyone have an R code for the Kruskal-Wallis test for gene expression data?
60 columns and 230 rows
Thanks
Hi friends,
Does anyone have an R code for the Kruskal-Wallis test for gene expression data?
60 columns and 230 rows
Thanks
Ah, the Kruskal-Wallis --the non-parametric ANOVA-- my favourite.
Here is some code for you:
In short, the function is kruskal.test()
As you will see, you will require some metadata, the rows of which will have to be aligned to your expression data columns, which you will have to transpose (the expression data needs to be transposed), such that genes are columns and samples are rows. This metadata should contain one or more categorical variables that each contain two or more groups (like disease
|nomal
, group1
|group2
|group3
, et cetera), the expression of a given gene across which you will compute the Kruskal-Wallis test.
Kevin
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Thank you Kevin The code you shared is for one column (Ozone). My problem is I don't know how to customize it for multiple columns. Is there any way?
There are a few different ways to do that. Here is a reproducible example that eventually outputs a named vector of p-values, which I trust that you can adapt to your own data:
We're unlucky this time, as, in this random data generated on this glorious Sunday of May 1st 2022, nothing was statistically significant.
Thanks Kevin, I didnot understand, do we have one data and one metadata files? or just one file?
So, I tried to run with my data file and I got this error :
code chunk:
You need to figure this out on your own - sorry. Somebody else may additionally help.