R/relocate.R

Defines functions relocate.corpus

Documented in relocate.corpus

#' @name relocate
#' @rdname dplyr_single
#' @importFrom dplyr relocate
#' @export
NULL

#' Change column order of document variables
#'
#' Use `relocate()` to change the column positions of document variables, using
#' the same syntax as [select()][select.corpus()] to make it easy to move blocks
#' of columns at once.
#' 
#' @inheritParams dplyr::relocate
#' @export
#' @examples
#' data_corpus_inaugural %>%
#'   relocate(President, Party) %>%
#'   summary(n = 5)
#'
#' data_corpus_inaugural %>%
#'   relocate(FirstName, President, .before = Year) %>%
#'   summary(n = 5)
relocate.corpus <- function(.data, ...) {
  corpus_stv_byvar(.data, ..., fun = relocate)
}
quanteda/quanteda.tidy documentation built on April 11, 2021, 3:44 p.m.