get_pivot_vars: Create a table with one row per pivot variable

Description Usage Arguments Value Examples

View source: R/pivot_module_tree.R

Description

Create a table with one row per pivot variable

Create a table with one row per pivot variable

Usage

1
2
3
get_pivot_vars(df, max_levels = 1000)

get_pivot_vars(df, max_levels = 1000)

Arguments

df

A local dataframe or tbl_dbi database table

max_levels

The maximum number of levels a pivot variable is allowed to have.

df

A local dataframe or tbl_dbi database table

max_levels

The maximum number of levels a pivot variable is allowed to have.

Value

A tibble with one row per pivot variable with the variable's name, number of levels, and a list column containing the levels.

A tibble with one row per pivot variable with the variable's name, number of levels, and a list column containing the levels.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# local table
df1 <- starwars %>%
     select_if(is.character)
pivot_vars1 <- get_pivot_vars(df1)

# using a database
con <- DBI::dbConnect(RSQLite::SQLite(), path = ":memory:")
copy_to(con, df1, "star_wars")
df2 <- tbl(con, "star_wars")
pivot_vars2 <- get_pivot_vars(df2)

# local table
df1 <- starwars %>%
     select_if(is.character)
pivot_vars1 <- get_pivot_vars(df1)

# using a database
con <- DBI::dbConnect(RSQLite::SQLite(), path = ":memory:")
copy_to(con, df1, "star_wars")
df2 <- tbl(con, "star_wars")
pivot_vars2 <- get_pivot_vars(df2)

ablack3/shinyPivot documentation built on Aug. 25, 2019, 2:35 p.m.