generate_report: Generate A CSPS Report

Description Usage Arguments Value Examples

View source: R/report.R

Description

Provide microdata and unit codes to generate a report from a template. Designed for use by designated analysts who have access to Civil Service People Survey data for their organisation.

Usage

1
generate_report(microdata, hierarchy, metadata, unit_codes, out_dir)

Arguments

microdata

A data.frame. Your organisation's microdata file that contains the responses of each respondent. Received as the file csps2019_flat.csv.

hierarchy

A data.frame. The lookup file that matches each respondent to their unit code. Received in the file csps2019_hierarchy.csv.

metadata

A data.frame. The file that provides additional metadata about each unit, such as headcount and name. Received in the file csps2019_hierarchy_metadata.csv.

unit_codes

A character vector of organisational unit codes in the form "XX0000".

out_dir

Character. An existing directory to which the output will be written.

Value

A rendered PDF file in the provided location.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
    # Read files
    library(readr)
    micro_df <- read_csv("~/Documents/CO2019_flat.csv",)
    hier_df <- read_csv("~/Documents/CO2019_hierarchy.csv")
    meta_df <- read_csv("~/Documents/CO2019_hierarchy_metadata.csv")

    # Create a report for the specified unit codes
    generate_report(
        microdata = micro_df,
        hierarchy = hier_df,
        metadata = meta_df,
        unit_codes = c("CO0027", "CO0205", "CO0384"),
        out_dir = "~/Documents/reports"
   )
   
## End(Not run)

co-analysis/cspsreports documentation built on Aug. 28, 2020, 12:04 a.m.