FM_fetch_data_format: Creates Formatting Information for Datasets

View source: R/formods.R

FM_fetch_data_formatR Documentation

Creates Formatting Information for Datasets

Description

Takes a data frame and information in the site configureation to produce formatting information to make it easier for the user to see data type information.

Usage

FM_fetch_data_format(df, state)

Arguments

df

Raw dataframe to be built into an rhandsontable.

state

Current module state after yaml file has been read.

Value

list with the following elements:

  • col_heads: List (element for each column) of formatting information for column headers to be use with rhandsontable.

  • col_subtext: List (element for each column) of subtext to be displayed in selections using 'pickerInput' from the 'shinyWidgets' package.

Examples

# We need a module state object to use this function:
sess_res = UD_test_mksession()
state = sess_res$state

data_file_local =  system.file(package="formods", "test_data", "TEST_DATA.xlsx")
sheet           = "DATA"

df = readxl::read_excel(path=data_file_local, sheet=sheet)

hfmt = FM_fetch_data_format(df, state)

# Column header formatting
head(as.vector(unlist( hfmt[["col_heads"]])))

# Column select subtext
head(as.vector(unlist( hfmt[["col_subtext"]])))

formods documentation built on April 12, 2025, 1:57 a.m.