Imports directory into store
Usage
import_directory(
store,
path,
read_function,
glob = NULL,
regexp = NULL,
recursive = TRUE,
...
)
Arguments
- store
instance of the store to import data into
- path
to directory containing the data files
- read_function
function with argument file, ... is passed to this function to supply additionals arguments
- glob
see
fs::dir_ls()
- regexp
see
fs::dir_ls()
- recursive
see
fs::dir_ls()
- ...
passed to the read_function
Examples
format <- rOstluft::format_rolf()
store <- rOstluft::storage_local_rds("example_rOstluft", format, read.only = FALSE)
#> Local store example_rOstluft initialized under 'C:\Users\tom\AppData\Local/rOstluft/example_rOstluft'
path <- system.file("extdata", package = "rOstluft.data")
rOstluft::import_directory(store, path, rOstluft::read_airmo_csv, glob = "*Jan.csv")
#> Importing 'C:/Users/tom/AppData/Local/R/cache/R/renv/library/rOstluft-c971cee0/R-4.3/x86_64-w64-mingw32/rOstluft.data/extdata/Zch_Stampfenbachstrasse_d1_2013_Jan.csv' with size 25.4K. File 1 of 3
#> Read 'C:/Users/tom/AppData/Local/R/cache/R/renv/library/rOstluft-c971cee0/R-4.3/x86_64-w64-mingw32/rOstluft.data/extdata/Zch_Stampfenbachstrasse_d1_2013_Jan.csv' in 0.21 seconds. Got 2170 data points
#> First put to storage. Save columns types to C:/Users/tom/AppData/Local/rOstluft/example_rOstluft/columns.rds
#> Put data into store example_rOstluft in 0.09 seconds
#> Importing 'C:/Users/tom/AppData/Local/R/cache/R/renv/library/rOstluft-c971cee0/R-4.3/x86_64-w64-mingw32/rOstluft.data/extdata/Zch_Stampfenbachstrasse_h1_2013_Jan.csv' with size 142K. File 2 of 3
#> Read 'C:/Users/tom/AppData/Local/R/cache/R/renv/library/rOstluft-c971cee0/R-4.3/x86_64-w64-mingw32/rOstluft.data/extdata/Zch_Stampfenbachstrasse_h1_2013_Jan.csv' in 0.08 seconds. Got 14116 data points
#> Put data into store example_rOstluft in 0.12 seconds
#> Importing 'C:/Users/tom/AppData/Local/R/cache/R/renv/library/rOstluft-c971cee0/R-4.3/x86_64-w64-mingw32/rOstluft.data/extdata/Zch_Stampfenbachstrasse_min30_2013_Jan.csv' with size 258K. File 3 of 3
#> Read 'C:/Users/tom/AppData/Local/R/cache/R/renv/library/rOstluft-c971cee0/R-4.3/x86_64-w64-mingw32/rOstluft.data/extdata/Zch_Stampfenbachstrasse_min30_2013_Jan.csv' in 0.09 seconds. Got 28234 data points
#> Put data into store example_rOstluft in 0.10 seconds
#> Finished import after 0.70 seconds
store$get_content()
#> # A tibble: 108 × 6
#> year interval site parameter unit n
#> <dbl> <fct> <fct> <fct> <fct> <int>
#> 1 2013 min30 Zch_Stampfenbachstrasse CO mg/m3 1484
#> 2 2013 min30 Zch_Stampfenbachstrasse CO ppm 1484
#> 3 2013 min30 Zch_Stampfenbachstrasse Hr %Hr 1487
#> 4 2013 min30 Zch_Stampfenbachstrasse NO µg/m3 1484
#> 5 2013 min30 Zch_Stampfenbachstrasse NO ppb 1484
#> 6 2013 min30 Zch_Stampfenbachstrasse NO2 µg/m3 1484
#> 7 2013 min30 Zch_Stampfenbachstrasse NO2 ppb 1484
#> 8 2013 min30 Zch_Stampfenbachstrasse NOx ppb 1484
#> 9 2013 min30 Zch_Stampfenbachstrasse O3 µg/m3 1488
#> 10 2013 min30 Zch_Stampfenbachstrasse O3 ppb 1488
#> # ℹ 98 more rows
store$destroy("DELETE")
#> Store example_rOstluft destroyed