I have a formula that I want to modify with a string variable. For some reason, when I try to modify it, a list object is created instead of a formula. The code I;ve written feels awkward, if someone has a solution or even better suggestion to get me what I need.
Thanks in advance,
Kenneth
# this is the formula I start with
> design(dds)
~trial + trial:condition
> class(design(dds))
[1] "formula"
# this is the variable I want to append with
> colnames(ruv_s_cov)
[1] "W_1" "W_2"
> class(colnames(ruv_s_cov))
[1] "character"
# this is what I want
>design(dds)
~ trial + trial:condition + W_1 + W_2
> class(design(dds))
[1] "formula"
# this is how it would be done manually
# ...which I don't want to do because I could be adding anything up to W_20
design(dds) <- ~ trial + trial:condition + W_1 + W_2
This is closest attempt but it adds "list()" to the end: