Hi there,
I am trying to automate an RNA-seq protocol based on the normalisation function `RUVs`

which determines k factors of unwanted variation in your dataset that are then fitted in the `model.matrix`

that you provide to edgeR in a way like this `design <- model.matrix(~0+treatments + W_1 + W_2 + W_3 + W_4 + W_5, data=pData(set))`

. This example has `k=5`

factors of unwanted variation (stored in my `pData(set)`

object). If with another dataset I had three factors of unwanted variation, then the code would be `design <- model.matrix(~0+treatments + W_1 + W_2 + W_3, data=pData(set))`

.
How can I have a "generalised" version of the code that accounts for all the unwanted factors of variation in my `pData(set)`

object without the need to manually type them into the formula?

Thanks in advance Luca

That's exactly what I needed! Thanks man! :D