set_int | R Documentation |
set integer
set_int(.data, ...)
## S3 method for class 'data.frame'
set_int(.data, ...)
## S3 method for class 'grouped_df'
set_int(.data, ...)
.data |
dataframe |
... |
tidyselect. Default Selecton: integerish doubles or integerish characters |
tibble
int_vec <- c("1", "2", "10")
tibble::tibble(
chr_int = int_vec,
dbl_int = c(1.0, 5.0, 20.0),
chr_int64 = c("1033493932", "4432500065", "30303022192"),
string_int = c("SALES2020", "SALES2021", "SALES2022")) -> tbl
# automatically coerce integerish cols in a tibble
tbl
# integerish doubles or chars will be detected for coercion automatically
tbl %>%
set_int()
# string_int requires parsing, so it must be specified directly for coercion
tbl %>%
set_int(matches("str|chr"))
# s3 method works for vectors as well
int_vec
int_vec %>%
set_int()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.