Skip to contents

twriTemplates comes with five bundled example data files in its inst/extdata directory. This function makes them easy to access for practice reading with read.csv() or readr::read_csv().

Usage

path_to_file(file = NULL)

Source

This function is adapted from readxl::readxl_example()

Arguments

file

Name of the file in quotes with extension; "arroyo_swqm.txt", "dissolved_oxygen_raw.csv", "easterwood.csv", "marabwq2021.csv", or "marcewq2021.csv" will work. If NULL, the example files will be listed.

Value

file path

Examples

path_to_file()
#> [1] "arroyo_swqm.txt"          "dissolved_oxygen_raw.csv"
#> [3] "easterwood.csv"           "marabwq2021.csv"         
#> [5] "marcewq2021.csv"         
path_to_file("easterwood.csv")
#> [1] "/home/runner/work/_temp/Library/twriTemplates/extdata/easterwood.csv"
head(read.csv(path_to_file("easterwood.csv")))
#>      station       date                                    name
#> 1 7.4746e+10 2010-07-31 COLLEGE STATION EASTERWOOD FIELD, TX US
#> 2 7.4746e+10 2010-08-01 COLLEGE STATION EASTERWOOD FIELD, TX US
#> 3 7.4746e+10 2010-08-02 COLLEGE STATION EASTERWOOD FIELD, TX US
#> 4 7.4746e+10 2010-08-03 COLLEGE STATION EASTERWOOD FIELD, TX US
#> 5 7.4746e+10 2010-08-04 COLLEGE STATION EASTERWOOD FIELD, TX US
#> 6 7.4746e+10 2010-08-05 COLLEGE STATION EASTERWOOD FIELD, TX US
#>   dailymaximumdrybulbtemperature dailyprecipitation
#> 1                             99                  0
#> 2                            102                  0
#> 3                            101                  0
#> 4                            100                  0
#> 5                             99                  0
#> 6                             99                  0