Hello I have a count matrix ( gene * sample), my samples can be divided to days ( day 0 to day 4) and for each day I have 7 replicates. I want to filter based on the variance (exclude the genes with low variance). I know how to calculate row-wise variance BUT now I want to calculate the variance between the days(subset of samples) and not across each individual sample
The code I have used for calculating variance is the following
How I can edit it in order to take the variance between days and not between individual samples?
data$variance = apply(data, 1, var) data2 = data[data$variance >= quantile(data$variance, c(.50)), ] #50% most variable genes data2$variance <- NULL
Thanks in advance,