Skip to content

Commit

Permalink
finishing updates related to exporting %>% pipe
Browse files Browse the repository at this point in the history
incl. lots of removing library(dplyr) from examples
  • Loading branch information
sfirke committed Apr 14, 2017
1 parent 28fafcb commit 866cb81
Show file tree
Hide file tree
Showing 21 changed files with 17 additions and 30 deletions.
3 changes: 0 additions & 3 deletions R/add_totals.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#' @return Returns a data.frame augmented with a totals row, column, or both.
#' @export
#' @examples
#' library(dplyr) # for the %>% pipe
#' mtcars %>%
#' crosstab(am, cyl) %>%
#' adorn_totals()
Expand Down Expand Up @@ -66,7 +65,6 @@ adorn_totals <- function(dat, which = c("row", "col"), fill = "-", na.rm = TRUE)
#' @return Returns a data.frame with a totals row, consisting of "Total" in the first column and column sums in the others.
#' @export
#' @examples
#' library(dplyr) # for the %>% pipe
#' mtcars %>%
#' crosstab(am, cyl) %>%
#' add_totals_row
Expand All @@ -88,7 +86,6 @@ add_totals_row <- function(dat, fill = "-", na.rm = TRUE){
#' @return Returns a data.frame with a totals column containing row-wise sums.
#' @export
#' @examples
#' library(dplyr) # for the %>% pipe
#' mtcars %>%
#' crosstab(am, cyl) %>%
#' add_totals_col
Expand Down
1 change: 0 additions & 1 deletion R/adorn_crosstab.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#' @param rounding method to use for truncating percentages - either "half to even", the base R default method, or "half up", where 14.5 rounds up to 15.
#' @return Returns a data.frame.
#' @examples
#' library(dplyr) # for the %>% pipe
#'mtcars %>%
#' crosstab(gear, cyl) %>%
#' adorn_crosstab(denom = "all")
Expand Down
2 changes: 1 addition & 1 deletion R/clean_names.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' # not run:
#' # clean_names(poorly_named_df)
#'
#' # library(dplyr) ; library(readxl)
#' # library(readxl)
#' # not run:
#' # readxl("messy_excel_file.xlsx") %>% clean_names()

Expand Down
2 changes: 1 addition & 1 deletion R/crosstab.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
#' crosstab(mtcars$cyl, mtcars$gear, "row")
#'
#' # Passing in a data.frame using a pipeline:
#' library(dplyr) # to access the pipe operator
#' mtcars %>% crosstab(cyl, gear)
#' mtcars %>% crosstab(cyl, gear, "row")
#'
#' # This allows for upstream operations
#' # prior to the crosstab() call:
#' library(dplyr)
#' mtcars %>%
#' filter(am == 0) %>%
#' crosstab(cyl, gear)
Expand Down
3 changes: 1 addition & 2 deletions R/get_dupes.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
#' @export
#' @examples
#' get_dupes(mtcars, mpg, hp)
#' # or called with magrittr pipe %>% :
#' library(dplyr)
#' # or called with the magrittr pipe %>% :
#' mtcars %>% get_dupes(wt)
#'

Expand Down
1 change: 0 additions & 1 deletion R/ns_to_percents.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#' @return Returns a data.frame of percentages, expressed as numeric values between 0 and 1.
#' @export
#' @examples
#' library(dplyr) # for the %>% pipe
#' mtcars %>%
#' crosstab(am, cyl) %>%
#' ns_to_percents(denom = "all")
Expand Down
4 changes: 0 additions & 4 deletions R/remove_empties.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
#' @return Returns the data.frame with no empty rows.
#' @export
#' @examples
#' # called with magrittr pipe %>% :
#' # library(dplyr)
#' # not run:
#' # dat %>% remove_empty_rows

Expand All @@ -25,8 +23,6 @@ remove_empty_rows <- function(dat){
#' @return Returns the data.frame with no empty columns.
#' @export
#' @examples
#' # called with magrittr pipe %>% :
#' # library(dplyr)
#' # not run:
#' # dat %>% remove_empty_cols
#'
Expand Down
1 change: 0 additions & 1 deletion R/tabyl.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#' tabyl(mtcars$cyl, sort = TRUE)
#'
#' # Passing in a data.frame using a pipeline:
#' library(dplyr) # to access the pipe operator
#' mtcars %>% tabyl(cyl, sort = TRUE)
#'
#' # illustrating show_na functionality:
Expand Down
6 changes: 5 additions & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@

#' Pipe operator
#'
#' See \code{\link[magrittr]{\%>\%}} for more details.
#' @description Exported from the magrittr package. To learn more, run \code{?magrittr::`\%>\%`}.
#'
#' @name %>%
#' @rdname pipe
#' @keywords internal
#' @export
#' @importFrom magrittr %>%
#' @usage lhs \%>\% rhs
#' @examples
#' mtcars %>%
#' crosstab(carb, cyl) %>%
#' adorn_totals()
NULL
1 change: 0 additions & 1 deletion man/add_totals_col.Rd

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

1 change: 0 additions & 1 deletion man/add_totals_row.Rd

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

1 change: 0 additions & 1 deletion man/adorn_crosstab.Rd

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

1 change: 0 additions & 1 deletion man/adorn_totals.Rd

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

2 changes: 1 addition & 1 deletion man/clean_names.Rd

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

2 changes: 1 addition & 1 deletion man/crosstab.Rd

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

3 changes: 1 addition & 2 deletions man/get_dupes.Rd

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

1 change: 0 additions & 1 deletion man/ns_to_percents.Rd

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

7 changes: 6 additions & 1 deletion man/pipe.Rd

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

2 changes: 0 additions & 2 deletions man/remove_empty_cols.Rd

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

2 changes: 0 additions & 2 deletions man/remove_empty_rows.Rd

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

1 change: 0 additions & 1 deletion man/tabyl.Rd

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

0 comments on commit 866cb81

Please sign in to comment.