Skip to content

Commit

Permalink
Keep pillar attribute to ensure formatting survives subsetting
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Mar 24, 2021
1 parent 5982370 commit 9c3b6bb
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions R/make_units.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@
}

restore_units <- function(x, to) {
attrs <- attributes(to)
attrs$names <- NULL
attrs$dim <- NULL
attrs$dimnams <- NULL

attributes(x)[names(attrs)] <- attrs
x
out <- .as.units(x, to)
attr(out, "pillar") <- attr(to, "pillar")
out
}

#' @name units
Expand Down

0 comments on commit 9c3b6bb

Please sign in to comment.