R/pull_dt.R

Defines functions pull_dt

Documented in pull_dt

#' @title Pull out a single variable
#' @description Extract vector from data.frame, works likt `[[`. Analogous function for \code{pull} in \pkg{dplyr}
#' @param .data data.frame
#' @param col A name of column or index (should be positive).
#' @return vector
#' @seealso \code{\link[dplyr]{pull}}
#' @examples
#' mtcars %>% pull_dt(2)
#' mtcars %>% pull_dt(cyl)
#' mtcars %>% pull_dt("cyl")
#' @export

pull_dt = function(.data,col) .data[[substitute(col)]]

# pull_dt = function(.data,col) eval.parent(substitute(.data[[col]]))

Try the tidyfst package in your browser

Any scripts or data that you put into this service are public.

tidyfst documentation built on Sept. 16, 2024, 9:06 a.m.