Skip to content

Commit cab11b7

Browse files
committed
clean up docs
1 parent 5d46333 commit cab11b7

File tree

3 files changed

+23
-344
lines changed

3 files changed

+23
-344
lines changed

R/dplyr_methods.R

+11-161
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#' @details
1616
#' ## Locales
1717
#' The sort order for character vectors will depend on the collating sequence
18-
#' of the locale in use: see [locales()].
18+
#' of the locale in use: see locales().
1919
#'
2020
#' ## Missing values
2121
#' Unlike base sorting with `sort()`, `NA` are:
@@ -29,12 +29,6 @@
2929
#' * Columns are not modified.
3030
#' * Groups are not modified.
3131
#' * Data frame attributes are preserved.
32-
#' @section Methods:
33-
#' This function is a **generic**, which means that packages can provide
34-
#' implementations (methods) for other classes. See the documentation of
35-
#' individual methods for extra arguments and differences in behaviour.
36-
#'
37-
#' The following methods are currently available in loaded packages:
3832
#'
3933
#' @rdname dplyr-methods
4034
#' @name arrange
@@ -44,7 +38,7 @@
4438
#' lazy data frame (e.g. from dbplyr or dtplyr). See *Methods*, below, for
4539
#' more details.
4640
#' @param ... <[`tidy-eval`][dplyr_eval]> Variables, or functions or
47-
#' variables. Use [desc()] to sort a variable in descending order.
41+
#' variables. Use desc() to sort a variable in descending order.
4842
#' @param .by_group If TRUE, will sort first by grouping variable. Applies to grouped data frames only.
4943
#'
5044
#' @family single table verbs
@@ -91,7 +85,7 @@ arrange.Seurat <- function(.data, ..., .by_group = FALSE) {
9185
#'
9286
#' When column-binding, rows are matched by position, so all data
9387
#' frames must have the same number of rows. To match by value, not
94-
#' position, see [mutate-joins].
88+
#' position, see mutate-joins.
9589
#' @param .id Data frame identifier.
9690
#'
9791
#' When `.id` is supplied, a new column of identifiers is
@@ -231,29 +225,11 @@ distinct.Seurat <- function (.data, ..., .keep_all = FALSE)
231225
#'
232226
#' dplyr is not yet smart enough to optimise filtering optimisation
233227
#' on grouped datasets that don't need grouped calculations. For this reason,
234-
#' filtering is often considerably faster on [ungroup()]ed data.
228+
#' filtering is often considerably faster on ungroup()ed data.
235229
#'
236230
#' @importFrom dplyr filter
237231
#'
238-
#' @section Useful filter functions:
239232
#'
240-
#' * [`==`], [`>`], [`>=`] etc
241-
#' * [`&`], [`|`], [`!`], [xor()]
242-
#' * [is.na()]
243-
#' * [between()], [near()]
244-
#'
245-
#' @section Grouped tibbles:
246-
#'
247-
#' Because filtering expressions are computed within groups, they may
248-
#' yield different results on grouped tibbles. This will be the case
249-
#' as soon as an aggregating, lagging, or ranking function is
250-
#' involved. Compare this ungrouped filtering:
251-
#'
252-
#'
253-
#' The former keeps rows with `mass` greater than the global average
254-
#' whereas the latter keeps rows with `mass` greater than the gender
255-
#'
256-
#' average.
257233
#' @family single table verbs
258234
#' @inheritParams arrange
259235
#' @param ... <[`tidy-eval`][dplyr_eval]> Logical predicates defined in
@@ -274,8 +250,6 @@ distinct.Seurat <- function (.data, ..., .keep_all = FALSE)
274250
#' implementations (methods) for other classes. See the documentation of
275251
#' individual methods for extra arguments and differences in behaviour.
276252
#'
277-
#' The following methods are currently available in loaded packages:
278-
#' @seealso [filter_all()], [filter_if()] and [filter_at()].
279253
#'
280254
#' @rdname dplyr-methods
281255
#' @name filter
@@ -326,9 +300,9 @@ filter.Seurat <- function (.data, ..., .preserve = FALSE)
326300
#' This argument was previously called `add`, but that prevented
327301
#' creating a new grouping variable called `add`, and conflicts with
328302
#' our naming conventions.
329-
#' @param .drop When `.drop = TRUE`, empty groups are dropped. See [group_by_drop_default()] for
303+
#' @param .drop When `.drop = TRUE`, empty groups are dropped. See group_by_drop_default() for
330304
#' what the default value is for this argument.
331-
#' @return A [grouped data frame][grouped_df()], unless the combination of `...` and `add`
305+
#' @return A grouped data frame, unless the combination of `...` and `add`
332306
#' yields a non empty set of grouping columns, a regular (ungrouped) data frame
333307
#' otherwise.
334308
#' @section Methods:
@@ -373,27 +347,7 @@ group_by.Seurat <- function (.data, ..., .add = FALSE, .drop = group_by_drop_def
373347
#'
374348
#' @importFrom dplyr summarise
375349
#'
376-
#' @section Useful functions:
377350
#'
378-
#' * Center: [mean()], [median()]
379-
#' * Spread: [sd()], [IQR()], [mad()]
380-
#' * Range: [min()], [max()], [quantile()]
381-
#' * Position: [first()], [last()], [nth()],
382-
#' * Count: [n()], [n_distinct()]
383-
#' * Logical: [any()], [all()]
384-
#'
385-
#' @section Backend variations:
386-
#'
387-
#' The data frame backend supports creating a variable and using it in the
388-
#' same summary. This means that previously created summary variables can be
389-
#' further transformed or combined within the summary, as in [mutate()].
390-
#' However, it also means that summary variables with the same names as previous
391-
#' variables overwrite them, making those variables unavailable to later summary
392-
#' variables.
393-
#'
394-
#' This behaviour may not be supported in other backends. To avoid unexpected
395-
#' results, consider using new names for your summary variables, especially when
396-
#' creating multiple summaries.
397351
#'
398352
#' @export
399353
#' @inheritParams arrange
@@ -405,30 +359,15 @@ group_by.Seurat <- function (.data, ..., .add = FALSE, .drop = group_by_drop_def
405359
#' * A vector of length 1, e.g. `min(x)`, `n()`, or `sum(is.na(y))`.
406360
#' * A vector of length `n`, e.g. `quantile()`.
407361
#' * A data frame, to add multiple columns from a single expression.
362+
#'
408363
#' @family single table verbs
409-
#' @return
410-
#' An object _usually_ of the same type as `.data`.
411-
#'
412-
#' * The rows come from the underlying `group_keys()`.
413-
#' * The columns are a combination of the grouping keys and the summary
414-
#' expressions that you provide.
415-
#' * If `x` is grouped by more than one variable, the output will be another
416-
#' [grouped_df] with the right-most group removed.
417-
#' * If `x` is grouped by one variable, or is not grouped, the output will
418-
#' be a [tibble].
419-
#' * Data frame attributes are **not** preserved, because `summarise()`
420-
#' fundamentally creates a new data frame.
421-
#' @section Methods:
422-
#' This function is a **generic**, which means that packages can provide
423-
#' implementations (methods) for other classes. See the documentation of
424-
#' individual methods for extra arguments and differences in behaviour.
425-
#'
426-
#' The following methods are currently available in loaded packages:
364+
#' @return A tibble
427365
#'
428366
#' @rdname dplyr-methods
429367
#' @name summarise
430368
#'
431369
#' @examples
370+
#'
432371
#' `%>%` = magrittr::`%>%`
433372
#' pbmc_small %>% summarise(mean(nCount_RNA))
434373
#'
@@ -457,20 +396,6 @@ summarise.Seurat <- function (.data, ...)
457396
#'
458397
#' @importFrom dplyr mutate
459398
#'
460-
#' @section Useful mutate functions:
461-
#'
462-
#' * [`+`], [`-`], [log()], etc., for their usual mathematical meanings
463-
#'
464-
#' * [lead()], [lag()]
465-
#'
466-
#' * [dense_rank()], [min_rank()], [percent_rank()], [row_number()],
467-
#' [cume_dist()], [ntile()]
468-
#'
469-
#' * [cumsum()], [cummean()], [cummin()], [cummax()], [cumany()], [cumall()]
470-
#'
471-
#' * [na_if()], [coalesce()]
472-
#'
473-
#' * [if_else()], [recode()], [case_when()]
474399
#'
475400
#' @section Grouped tibbles:
476401
#'
@@ -561,10 +486,6 @@ mutate.Seurat <- function(.data, ...)
561486
#'
562487
#' Rename individual variables using `new_name = old_name` syntax.
563488
#'
564-
#' @section Scoped selection and renaming:
565-
#'
566-
#' Use the three scoped variants ([rename_all()], [rename_if()], [rename_at()])
567-
#' to renaming a set of variables with a function.
568489
#'
569490
#' @importFrom dplyr rename
570491
#'
@@ -615,18 +536,10 @@ rename.Seurat <- function(.data, ...)
615536
#' Group input by rows
616537
#'
617538
#'
618-
#' See [this repository](https://github.com/jennybc/row-oriented-workflows)
619-
#' for alternative ways to perform row-wise operations.
620-
#'
621539
#' `rowwise()` is used for the results of [do()] when you
622540
#' create list-variables. It is also useful to support arbitrary
623541
#' complex operations that need to be applied to each row.
624542
#'
625-
#' Currently, rowwise grouping only works with data frames. Its
626-
#' main impact is to allow you to work with list-variables in
627-
#' [summarise()] and [mutate()] without having to
628-
#' use \code{[[1]]}. This makes `summarise()` on a rowwise tbl
629-
#' effectively equivalent to [plyr::ldply()].
630543
#'
631544
#' @importFrom dplyr rowwise
632545
#'
@@ -874,14 +787,6 @@ full_join.Seurat <- function (x, y, by = NULL, copy = FALSE, suffix = c(".x", ".
874787
#' to select, remove, and duplicate rows. It is accompanied by a number of
875788
#' helpers for common use cases:
876789
#'
877-
#' * `slice_head()` and `slice_tail()` select the first or last rows.
878-
#' * `slice_sample()` randomly selects rows.
879-
#' * `slice_min()` and `slice_max()` select rows with highest or lowest values
880-
#' of a variable.
881-
#'
882-
#' If `.data` is a [grouped_df], the operation will be performed on each group,
883-
#' so that (e.g.) `slice_head(df, n = 5)` will select the first five rows in
884-
#' each group.
885790
#'
886791
#' @importFrom dplyr slice
887792
#'
@@ -900,12 +805,6 @@ full_join.Seurat <- function (x, y, by = NULL, copy = FALSE, suffix = c(".x", ".
900805
#' The values provided must be either all positive or all negative.
901806
#' Indices beyond the number of rows in the input are silently ignored.
902807
#'
903-
#' For `slice_helpers()`, these arguments are passed on to methods.
904-
#'
905-
#'
906-
#' If `n` is greater than the number of rows in the group (or `prop > 1`),
907-
#' the result will be silently truncated to the group size. If the
908-
#' `prop`ortion of a group size is not an integer, it is rounded down.
909808
#' @return
910809
#' An object of the same type as `.data`. The output has the following
911810
#' properties:
@@ -914,19 +813,6 @@ full_join.Seurat <- function (x, y, by = NULL, copy = FALSE, suffix = c(".x", ".
914813
#' * Columns are not modified.
915814
#' * Groups are not modified.
916815
#' * Data frame attributes are preserved.
917-
#' @section Methods:
918-
#' These function are **generic**s, which means that packages can provide
919-
#' implementations (methods) for other classes. See the documentation of
920-
#' individual methods for extra arguments and differences in behaviour.
921-
#'
922-
#' Methods available in currently loaded packages:
923-
#'
924-
#' * `slice()`: \Sexpr[stage=render,results=rd]{dplyr:::methods_rd("slice")}.
925-
#' * `slice_head()`: \Sexpr[stage=render,results=rd]{dplyr:::methods_rd("slice_head")}.
926-
#' * `slice_tail()`: \Sexpr[stage=render,results=rd]{dplyr:::methods_rd("slice_tail")}.
927-
#' * `slice_min()`: \Sexpr[stage=render,results=rd]{dplyr:::methods_rd("slice_min")}.
928-
#' * `slice_max()`: \Sexpr[stage=render,results=rd]{dplyr:::methods_rd("slice_max")}.
929-
#' * `slice_sample()`: \Sexpr[stage=render,results=rd]{dplyr:::methods_rd("slice_sample")}.
930816
#'
931817
#' @rdname dplyr-methods
932818
#' @name slice
@@ -960,14 +846,9 @@ slice.Seurat <- function (.data, ..., .preserve = FALSE)
960846
#' Select (and optionally rename) variables in a data frame, using a concise
961847
#' mini-language that makes it easy to refer to variables based on their name
962848
#' (e.g. `a:f` selects all columns from `a` on the left to `f` on the
963-
#' right). You can also use predicate functions like [is.numeric] to select
849+
#' right). You can also use predicate functions like is.numeric to select
964850
#' variables based on their properties.
965851
#'
966-
#'
967-
#' ## Overview of selection features
968-
#'
969-
#' ```{r, child = "man/rmd/overview.Rmd"}
970-
#' ```
971852
#'
972853
#' @importFrom dplyr select
973854
#'
@@ -986,13 +867,6 @@ slice.Seurat <- function (.data, ..., .preserve = FALSE)
986867
#' * Data frame attributes are preserved.
987868
#' * Groups are maintained; you can't select off grouping variables.
988869
#'
989-
#' @section Methods:
990-
#' This function is a **generic**, which means that packages can provide
991-
#' implementations (methods) for other classes. See the documentation of
992-
#' individual methods for extra arguments and differences in behaviour.
993-
#'
994-
#' The following methods are currently available in loaded packages:
995-
#' \Sexpr[stage=render,results=rd]{dplyr:::methods_rd("select")}.
996870
#'
997871
#' @examples
998872
#'
@@ -1035,24 +909,7 @@ select.Seurat <- function (.data, ...)
1035909
#' Sample n rows from a table
1036910
#'
1037911
#' @description
1038-
#' \Sexpr[results=rd, stage=render]{lifecycle::badge("superseded")}
1039-
#' `sample_n()` and `sample_frac()` have been superseded in favour of
1040-
#' [slice_sample()]. While they will not be deprecated in the near future,
1041-
#' retirement means that we will only perform critical bug fixes, so we recommend
1042-
#' moving to the newer alternative.
1043-
#'
1044-
#' These functions were superseded because we realised it was more convenient to
1045-
#' have two mutually exclusive arguments to one function, rather than two
1046-
#' separate functions. This also made it to clean up a few other smaller
1047-
#' design issues with `sample_n()`/`sample_frac`:
1048-
#'
1049-
#' * The connection to `slice()` was not obvious.
1050-
#' * The name of the first argument, `tbl`, is inconsistent with other
1051-
#' single table verbs which use `.data`.
1052-
#' * The `size` argument uses tidy evaluation, which is surprising and
1053-
#' undocumented.
1054-
#' * It was easier to remove the deprecated `.env` argument.
1055-
#' * `...` was in a suboptimal position.
912+
#' Sample n rows from a table
1056913
#'
1057914
#' @importFrom dplyr sample_n
1058915
#'
@@ -1250,13 +1107,6 @@ add_count.Seurat <- function(x, ..., wt = NULL, sort = FALSE, name = NULL, .drop
12501107
#' as names for a named vector. Specified in a similar manner as \code{var}.
12511108
#' @param ... For use by methods.
12521109
#' @return A vector the same size as `.data`.
1253-
#' @section Methods:
1254-
#' This function is a **generic**, which means that packages can provide
1255-
#' implementations (methods) for other classes. See the documentation of
1256-
#' individual methods for extra arguments and differences in behaviour.
1257-
#'
1258-
#' The following methods are currently available in loaded packages:
1259-
#' \Sexpr[stage=render,results=rd]{dplyr:::methods_rd("pull")}.
12601110
#'
12611111
#' @rdname dplyr-methods
12621112
#' @name pull

man/bind.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)