Skip to contents

Read censored data from an external file

Usage

readMWRcens(censpth, runchk = TRUE, warn = TRUE)

Arguments

censpth

character string of path to the censored file

runchk

logical to run data checks with checkMWRcens

warn

logical to return warnings to the console (default)

Value

A formatted censored data frame that can be used for downstream analysis

Details

Date are imported with read_excel, checked with checkMWRcens, and formatted with formMWRcens. The input file includes rows for each parameter and two columns indicating the parameter name and number of missed or censored records for that parameter. The data are used to optionally complete the number of missed and censored records column for the completeness table created with tabMWRcom.

Examples

censpth <- system.file('extdata/ExampleCensored.xlsx', package = 'MassWateR')

censdat <- readMWRcens(censpth)
#> Running checks on censored data...
#> 	Checking column names... OK
#> 	Checking all required columns are present... OK
#> 	Checking for non-numeric values in Missed and Censored Records... OK
#> 	Checking for negative values in Missed and Censored Records... OK
#> 	Checking Parameter Name formats... OK
#> 
#> All checks passed!
head(censdat)
#> # A tibble: 3 × 2
#>   Parameter `Missed and Censored Records`
#>   <chr>                             <int>
#> 1 pH                                   12
#> 2 DO                                    1
#> 3 Nitrate                               0