make_sumtable: Sumtable

View source: R/make_sumtable.R

make_sumtableR Documentation

Sumtable

Description

Sumtable

Usage

make_sumtable(
  data,
  .products_colname,
  .attributes_colname,
  .attribute_value_colname,
  .id_cols,
  selected_products,
  selected_attributes
)

Arguments

data

input dataframe

.products_colname

products column

.attributes_colname

attribute names column

.attribute_value_colname

attribute values column

.id_cols

id columns

selected_products

vector of product names to be selected

selected_attributes

vector of attributes names to be selected

Value

c("tbl_df", "tbl", "data.frame")

Examples

data <- mtcars
data$product <- rownames(data)

data <- data %>%
  tidyr::pivot_longer(cols = -c(product, cyl))

data_transformed <- make_sumtable(data = data,
                                  .products_colname = product,
                                  .attributes_colname = name,
                                  .attribute_value_colname = value,
                                  .id_cols = -value,
                                  selected_products = c("Merc 280", "Fiat 128", "Mazda RX4"),
                                  selected_attributes = c("mpg", "disp"))


aigorahub/aigoraRPDashboard documentation built on May 30, 2022, 8:46 p.m.