pcr icon indicating copy to clipboard operation
pcr copied to clipboard

Use column in data table for grouping when column name is passed as string to group_var

Open marcora opened this issue 4 years ago • 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.

marcora avatar Nov 08 '21 16:11 marcora

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.

MahShaaban avatar Nov 09 '21 06:11 MahShaaban

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.

marcora avatar Nov 19 '21 22:11 marcora