Skip to content

Commit

Permalink
Make .refactorData() less chatty when unnecessary
Browse files Browse the repository at this point in the history
  • Loading branch information
stufield committed Sep 19, 2023
1 parent b4b827c commit 395f5af
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
3 changes: 1 addition & 2 deletions R/plotPDFbyGroup.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ plotPDFbyGroup <- function(data, apt, group.var, cols, xlim = NULL,
p <- data |>
dplyr::select(!!group.var, apt) |>
.refactorData() |> # this is about ghost levels
ggplot(aes(x = !!sym(apt),
color = !!group.var)) +
ggplot(aes(x = !!sym(apt), color = !!group.var)) +
geom_density(aes(fill = !!group_var),
alpha = ifelse(fill, 0.2, 1),
linewidth = ifelse(fill, 0.1, 0.75),
Expand Down
4 changes: 1 addition & 3 deletions R/plotVolcanoHTML.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ plotVolcanoHTML.default <- function(data, ...) {
#' variable name in `data` for the Target Names.
#' @importFrom SomaDataIO rn2col col2rn
#' @export
plotVolcanoHTML.data.frame <- function(data,
FC = signed.log2.fold.change,
p.vec = p.value,
plotVolcanoHTML.data.frame <- function(data, FC = signed.log2.fold.change, p.vec = p.value,
cutoff = 0.05 / nrow(data),
fc.cutoff = 1,
main = NULL, x.lab = NULL,
Expand Down
9 changes: 3 additions & 6 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,10 @@
for ( meta in nms ) {
levs <- levels(data[[meta]])
data[[meta]] <- droplevels(data[[meta]])
if ( interactive() ) {
levs2 <- levels(data[[meta]])
sdiff <- setdiff(levs, levels(data[[meta]]))
if ( length(sdiff) > 0L && interactive() ) {
.info(
paste("Dropping levels",
value(setdiff(levs, levs2)),
"from",
value(meta))
paste("Dropping levels", value(sdiff), "from", value(meta))
)
}
}
Expand Down

0 comments on commit 395f5af

Please sign in to comment.