Closed asyakhl closed 8 months ago
@lwaldron
My preference is to have groupCol = "GROUP"
be a factor in the data, output a message to the user what the reference value is, and clean up the code that uses 0/1 coding rather than have additional arguments (referenceGroup
and treatmentGroup
) added to the function. Note that these arguments have to be specified every time. What do you think?
@LiNk-NY
That works, should referenceGroup
and treatmentGroup
be kept as optional?
@LiNk-NY That works, should
referenceGroup
andtreatmentGroup
be kept as optional?
IMO, neither should be used and the reference should be taken from the variable's levels, e.g.,
levels(as.factor(letters[1:5]))[1]
## OR better
contrasts(as.factor(letters[1:5]))
My preference is to have groupCol = "GROUP" be a factor in the data, output a message to the user what the reference value is
I agree with @LiNk-NY since R already has this feature built-in to the factor
class. The user then only has to specify which is the "group" column using groupCol = "GROUP"
. I also agree with outputting a message to the user what the reference value is; the message could be like this:
msg <- c("The outcome variable is specified as '",
groupCol,
"' and the reference category is '",
levels(as.factor(relab[[groupCol]]))[1],
"'. See `?factor` or `?relevel` to change the reference category.")
message(msg)
Hi Asya, @asyakhl
I simplified the code a bit adn incorporated the feedback above into the plot_groups
branch.
If there is anything I missed, please create a new PR based on the current plot_groups
branch.
Best,
Marcel
Added referenceGroup and treatmentGroup arguments, code works well after testing.