Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap order of dim_names and met_name in as.tbl_cube #1374

Merged
merged 3 commits into from
Oct 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@

* When printing a grouped data frame the number of groups is now printed with thousands separators. (#1398)

* Swap order of `dim_names` and `met_name` arguments in `as.tbl_cube`
(for `array`, `table` and `matrix`) for consistency with `tbl_cube` and
`as.tbl_cube.data.frame`. Also, the `met_name` argument to `as.tbl_cube.table`
now defaults to `"Freq"` for consistency with `as.data.frame.table`.
(@krlmlr, #1374).

# dplyr 0.4.3

## Improved encoding support
Expand Down
9 changes: 5 additions & 4 deletions R/tbl-cube.r
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,10 @@ as.tbl_cube <- function(x, ...) UseMethod("as.tbl_cube")

#' @export
#' @rdname as.tbl_cube
#' @param met_name a string to use as the name for the metric
#' @param dim_names names of the dimesions. Defaults to the names of
#' @param met_name a string to use as the name for the measure
#' the \code{\link{dimnames}}.
as.tbl_cube.array <- function(x, met_name = deparse(substitute(x)),
dim_names = names(dimnames(x)), ...) {
as.tbl_cube.array <- function(x, dim_names = names(dimnames(x)), met_name = deparse(substitute(x)), ...) {
force(met_name)

dims <- dimnames(x)
Expand All @@ -191,7 +190,9 @@ undimname <- function(x) {

#' @export
#' @rdname as.tbl_cube
as.tbl_cube.table <- as.tbl_cube.array
as.tbl_cube.table <- function(x, dim_names = names(dimnames(x)), met_name = "Freq", ...) {
as.tbl_cube.array(x, dim_names = dim_names, met_name = met_name)
}

#' @export
#' @rdname as.tbl_cube
Expand Down
19 changes: 10 additions & 9 deletions man/as.tbl_cube.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.