Learn R Programming

framecleaner (version 0.2.1)

set_dbl: set double

Description

set double

Usage

set_dbl(.data, ...)

# S3 method for character set_dbl(.data, ...)

# S3 method for factor set_dbl(.data, ...)

# S3 method for Date set_dbl(.data, ...)

# S3 method for numeric set_dbl(.data, ...)

# S3 method for integer64 set_dbl(.data, ...)

# S3 method for data.frame set_dbl(.data, ...)

Value

tibble

Arguments

.data

dataframe

...

tidyselect. Default selection: none

Examples

Run this code



date_col <- c(lubridate::ymd(20180101), lubridate::ymd(20210420))


tibble::tibble(int = c(1L, 2L),
fct = factor(c(10, 11)),
date = date_col,
chr = c("a2.1", "rtg50.5")) -> t1

t1

t1 %>%
set_dbl(tidyselect::everything())

# s3 method works for vectors individually
# custom date coercion to represent date as a number. For lubridate's coercion method, use set_int
date_col %>%
set_dbl

Run the code above in your browser using DataLab