Learn R Programming

formods (version 0.2.1)

FM_fetch_data_format: 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)

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.

Arguments

df

Raw dataframe to be built into an rhandsontable.

state

Current module state after yaml file has been read.

Examples

Run this code
# 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"]])))

Run the code above in your browser using DataLab