read_psd: Import PEPFAR Structured Datasets to R

View source: R/read_psd.R

read_psdR Documentation

Import PEPFAR Structured Datasets to R

Description

'read_psd' imports a stored PEPFAR Structured Datasets (.zip, .txt, or .parquet). The function will read in a MSD, Genie, Financial, HRH, or DHI PEPFAR dataset, ensuring the column types are correct. The user has the ability to store the txt file as a rds or parquet file, significantly saving storage space on the computer (and can then remove the txt file after importing). Most of USAID/OHA processes and analyses rely on the use of the MSD file being read in via 'read_psd'. This function can be used in the PDAP space in addition to working locally.

Usage

read_psd(
  file,
  export_format = "none",
  remove_base_file = FALSE,
  retain_genie_cols = FALSE
)

Arguments

file

enter the full path to the PEPFAR structured dataset file

export_format

if desired, save the PSD in another compressed format, either "rds" or "parquet", default = "none"

remove_base_file

should original base file be removed if exporting in another compressed format? default = FALSE

retain_genie_cols

should Genie specific columns ('dataelementuid', 'categoryoptioncombouid', 'approvallevel', 'approvalleveldescription') be retained in the output dataset? default = FALSE

Examples


## Not run: 
#convert Q1 clean PSNU file from txt to Rds
#read in file for use
 path <- "~/Data/MER_Structured_Datasets_OU_IM_FY22-24_20240315_v2_1.zip"
 df_psnu <- read_psd(path) 
## End(Not run)


USAID-OHA-SI/gophr documentation built on Nov. 14, 2024, 8:30 p.m.