Entering edit mode
Many packages that do statistical analysis (such as DESeq2 or DEXSeq), use a design formula to specify the exact comparison. For example:
DESeqDataSet(se, design = ~ condition)
Where "condition" is the actual column name. I'd like to have the column name be adjustable. I tried using a variable in the formula:
design_col = "condition" DESeqDataSet(se, design = ~ design_col)
As might be expected, that does not work ("all variables in design formula must be columns in colData"). I then tried:
design_col = "condition" design_formula = paste("~", design_col) DESeqDataSet(se, design = design_formula)
That also gives an error ("Error: $ operator is invalid for atomic vectors").
Is there a way to use variables in the design formula?