Skip to content

Commit

Permalink
tidy functions not prefixed with "t" any more + dtx_rows()
Browse files Browse the repository at this point in the history
  • Loading branch information
phgrosjean committed Sep 12, 2022
1 parent 9876dfa commit e5c241e
Show file tree
Hide file tree
Showing 12 changed files with 542 additions and 647 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: svBase
Type: Package
Version: 1.2.0
Version: 1.2.1
Title: 'SciViews' - Functions for Base Objects like Data Frames
Description: Functions to manipulated the three main classes of "data frames"
for 'SciViews': data.frame, data.table and tibble. Allow to select the
Expand All @@ -12,7 +12,7 @@ Authors@R: c(person("Philippe", "Grosjean", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-2694-9471")))
Maintainer: Philippe Grosjean <[email protected]>
Depends: R (>= 4.1.0)
Imports: data.table, tibble, dplyr, tidyr, pillar, collapse, vctrs, ellipsis, zeallot
Imports: data.table, collapse, zeallot, tibble, dplyr, tidyr, pillar
Suggests: dtplyr, svMisc, covr, knitr, markdown, rmarkdown, testthat, spelling
License: GPL-2
URL: https://github.com/SciViews/svBase, https://www.sciviews.org/svBase/
Expand Down
54 changes: 12 additions & 42 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,24 @@ export(collect_dtt)
export(collect_dtx)
export(default_dtx)
export(dtbl)
export(dtbl_rows)
export(dtf)
export(dtf_rows)
export(dtt)
export(dtt_rows)
export(dtx)
export(fast_functions)
export(dtx_rows)
export(filter_ungroup)
export(fn)
export(fnobs_all)
export(fnobs_na)
export(fna)
export(is_dtbl)
export(is_dtf)
export(is_dtt)
export(is_dtx)
export(list_fstat_functions)
export(list_speedy_functions)
export(list_tidy_functions)
export(mutate_ungroup)
export(sadd_count)
export(sadd_tally)
export(sarrange)
Expand All @@ -57,7 +64,6 @@ export(sinner_join)
export(sleft_join)
export(smutate)
export(smutate_ungroup)
export(speedy_functions)
export(spivot_longer)
export(spivot_wider)
export(spull)
Expand All @@ -75,44 +81,7 @@ export(stransmute_ungroup)
export(suncount)
export(sungroup)
export(sunite)
export(tadd_count)
export(tadd_tally)
export(tarrange)
export(tbind_cols)
export(tbind_rows)
export(tcount)
export(tdistinct)
export(tdrop_na)
export(textract)
export(tfill)
export(tfilter)
export(tfilter_ungroup)
export(tfull_join)
export(tgroup_by)
export(tidy_functions)
export(tinner_join)
export(tleft_join)
export(tmutate)
export(tmutate_ungroup)
export(tpivot_longer)
export(tpivot_wider)
export(tpull)
export(trename)
export(trename_with)
export(treplace_na)
export(tright_join)
export(tselect)
export(tseparate)
export(tseparate_rows)
export(tsummarise)
export(ttally)
export(ttransmute)
export(ttransmute_ungroup)
export(tuncount)
export(tungroup)
export(tunite)
import(ellipsis)
import(vctrs)
export(transmute_ungroup)
import(zeallot)
importFrom(collapse,fgroup_by)
importFrom(collapse,fgroup_vars)
Expand Down Expand Up @@ -156,6 +125,7 @@ importFrom(dplyr,ungroup)
importFrom(pillar,tbl_sum)
importFrom(tibble,as_tibble)
importFrom(tibble,tibble)
importFrom(tibble,tribble)
importFrom(tidyr,drop_na)
importFrom(tidyr,extract)
importFrom(tidyr,fill)
Expand Down
10 changes: 9 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# svBase 1.2.1

- The tidy functions are reworked to use the original function name, not the one with a "t" prefix.

- The functions that list family functions now start with `list_`, like `list_tidy_functions()`, `list_speedy_functions()` or `list_fstat_functions()`.

- `dtx_rows()` and other similar functions are added to avoid using `dtx(tribble(...))`.

# svBase 1.2.0

- Addition of "tidy" 't' functions and "speedy" 's' functions. The tidy functions are mostly renamed versions of {dplyr} or {tidyr} functions, while the speedy functions have a similar interface but are from {collapse} or {data.table} for a big part of them. Arguments are homogenized and sometimes reduced to restrict to features that are compatibles in the two groups.

- The function `n()` is not working in `ssumarise()`. Use `fn(var)` instead, and you can also use it in `tsummarise()`.

- Addition of "fast" functions from {collapse} + `fnobs_all()` and `fnobs_na`.
- Addition of "fast" functions from {collapse} + `fn()` and `fna()`.

- The `%xf%` operators where `x`can be `-`, `/`, etc. for a more readable alternative to `TRA=` in the fast functions.

Expand Down
46 changes: 46 additions & 0 deletions R/dtx_rows.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#' Row-wise creation of a data frame
#'
#' @description The presentation of the data (see examples) is easier to read
#' than with the traditional column-wise entry in [dtx()]. This could be used
#' to enter small tables in R, but do not abuse of it!
#'
#' @param ... Specify the structure of the data frame by using formulas for
#' variable names like `~x` for variable `x`. Then, use one argument per value
#' in the data frame. It is possible to unquote with `!!` and to
#' unquote-splice with `!!!`.
#'
#' @return A data frame of class **data.frame** for [dtf_rows()], **data.table**
#' for [dtt_rows()], tibble **tbl_df** for [dtbl_rows()] and the default object
#' with [dtx_rows()].
#'
#' @export
#'
#' @examples
#' df <- dtx_rows(
#' ~x, ~y, ~group,
#' 1, 3, "A",
#' 6, 2, "A",
#' 10, 4, "B"
#' )
#' df
dtx_rows <- function(...) {
dtx(tribble(...))
}

#' @export
#' @rdname dtx_rows
dtf_rows <- function(...) {
dtf(tribble(...))
}

#' @export
#' @rdname dtx_rows
dtt_rows <- function(...) {
dtt(tribble(...))
}

#' @export
#' @rdname dtx_rows
dtbl_rows <- function(...) {
tribble(...)
}
Loading

0 comments on commit e5c241e

Please sign in to comment.