gethklips {tidyklips}R Documentation

‘gethklips()’ is used to obtain data.frame for KLIPS (head of household survey)

Description

‘gethklips()’ is used to obtain data.frame for KLIPS (head of household survey)

Usage

gethklips(
  path,
  year,
  datatype = c("stata", "spss", "sas", "xlsx"),
  klipsvars = c("0141", "2102"),
  outvars = c("province", "income")
)

Arguments

path

A string vector specifying folder containing KLIPS head of household survey data

year

an integer vector specifying the years from 1998 to 2023 that the user wants to include in the dataframe.

datatype

A string vector specifying the format of the raw data you want to convert to a data frame ("spss", "sas", "stata", "excel")

klipsvars

A string vector specifying the variables in the raw data that you want to convert to a data frame ("0141", "2102")

outvars

A string vector specifying the variable names of converted data ("province", "income")

Value

A data frame containing klips household member data with the specified years and variables.

Examples


path <- system.file("extdata", package = "tidyklips")
df <- gethklips(path = path, year = 2023, datatype = "stata")
df %>%
  dplyr::group_by(year) %>%
  dplyr::summarise(count = dplyr::n()) %>%
  dplyr::mutate(proportion = count / sum(count))



[Package tidyklips version 0.3.0 Index]