mdl_vars_create_from_dataframe: Create variables metadata from a data frame

View source: R/variables.R

mdl_vars_create_from_dataframeR Documentation

Create variables metadata from a data frame

Description

Starting from a data frame, this function will create the variables metadata for a given survey. The function will calculate for each variable the main stats and get the variable labels when available. Labels must be set to the data frame using the labelled::var_label function or the data frame must be imported from a Stata file using the haven::read_dta function.

Usage

mdl_vars_create_from_dataframe(
  survey_idno,
  data_frame,
  file_id,
  file_name,
  file_description
)

Arguments

survey_idno

The unique identifier of an existing survey, e.g.: UNHCR_ETH_2020_SENS_v2.1

data_frame

A data frame containing the data.

file_id

An unique identifier for the file containing the variables metadata. If not provided, the name of the file will be used. If provided, the ID should only include alphanumeric chars. This ID is not shown in the platform, it is mostly used for fetching or modifying the metadata in a second moment.

file_name

The name of the file containing the variables as you want it to be shown in the platform to the final user.

file_description

Brief description of the file, as you want it to be shown in the platform to the final user.

Value

API call response.


UNHCRmdl/mdl documentation built on Jan. 15, 2025, 6:40 p.m.