Use column in data table for grouping when column name is passed as string to group_var
marcora opened this issue · 2 comments
It would be nice if I could specify a column name as grouping variable instead of supplying it as a vector.
For example:
pcr_analyze(ct1,
group_var = 'tissue',
reference_gene = 'GAPDH',
reference_group = 'brain',
method = 'delta_delta_ct')
would use values in the 'tissue' column as grouping variable.
Same approach could be used for specifying covariates for lm, if covariate (or target_gene) column name(s) could be specified rather than implying all columns correspond to genes.
The problem with this approach is that the user would have to also specify the column names for the genes of interest. I chose early on to make the main input data.frame to be only the Ct values to simplify things.
The column names for the genes of interest can be automatically generated by subtracting the columns specified in the "reference_gene" and "group_var" parameter (and an additional "covars" parameter listing, as a string or string vector, column name(s) for covariate(s)). No need for the user to list the names of all "genes of interest" columns.