Skip to contents

Import rawdata

Usage

import_rawdata(csv_dir, sep = ";", ...)

Arguments

csv_dir

path to directory with .csv files

sep

Single character used to separate fields within a record (default: in GERMAN format, i.e. sep = ";")

...

further arguments passed to either readr::read_csv2 (default for sep == ';') or readr::read_csv (if sep == ',')

Value

data.frame with all imported raw data

Examples

zipfile <- system.file("extdata/umberto-nxt_v7.1.0.13.503/Beispiel_Auswertung.zip", 
package = "kwb.umberto")
umberto7_csv_dir <- file.path(tempdir(), "Beispiel_Auswertung")
unzip(zipfile, exdir = umberto7_csv_dir)
umberto7_rawdata <- kwb.umberto::import_rawdata(csv_dir = umberto7_csv_dir)
#> Importing csv file 'C:\Users\RUNNER~1\AppData\Local\Temp\RtmpgX0H5o/Beispiel_Auswertung/Ref_High_C+N.csv'
#>  Using "','" as decimal and "'.'" as grouping mark. Use `read_delim()` for more control.
#> Rows: 19996 Columns: 12
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ";"
#> chr (11): Project, Model, Net, Timestamp, Product, LCI Method, Phase, Proces...
#> dbl  (1): Quantity
#> 
#>  Use `spec()` to retrieve the full column specification for this data.
#>  Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> Importing csv file 'C:\Users\RUNNER~1\AppData\Local\Temp\RtmpgX0H5o/Beispiel_Auswertung/Ref_High_C+high N.csv'
#>  Using "','" as decimal and "'.'" as grouping mark. Use `read_delim()` for more control.
#> Rows: 19996 Columns: 12
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ";"
#> chr (11): Project, Model, Net, Timestamp, Product, LCI Method, Phase, Proces...
#> dbl  (1): Quantity
#> 
#>  Use `spec()` to retrieve the full column specification for this data.
#>  Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> Importing csv file 'C:\Users\RUNNER~1\AppData\Local\Temp\RtmpgX0H5o/Beispiel_Auswertung/Ref_Low_C+N.csv'
#>  Using "','" as decimal and "'.'" as grouping mark. Use `read_delim()` for more control.
#> Rows: 19996 Columns: 12
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ";"
#> chr (11): Project, Model, Net, Timestamp, Product, LCI Method, Phase, Proces...
#> dbl  (1): Quantity
#> 
#>  Use `spec()` to retrieve the full column specification for this data.
#>  Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> Importing csv file 'C:\Users\RUNNER~1\AppData\Local\Temp\RtmpgX0H5o/Beispiel_Auswertung/Ref_Low_C+high N.csv'
#>  Using "','" as decimal and "'.'" as grouping mark. Use `read_delim()` for more control.
#> Rows: 19996 Columns: 12
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ";"
#> chr (11): Project, Model, Net, Timestamp, Product, LCI Method, Phase, Proces...
#> dbl  (1): Quantity
#> 
#>  Use `spec()` to retrieve the full column specification for this data.
#>  Specify the column types or set `show_col_types = FALSE` to quiet this message.
head(umberto7_rawdata)
#>                project           model      net           timestamp
#>                 <char>          <char>   <char>              <char>
#> 1: POWERSTEP_LargeWWTP 0b_Ref_High_C+N Main Net 11.10.2017 13:07:54
#> 2: POWERSTEP_LargeWWTP 0b_Ref_High_C+N Main Net 11.10.2017 13:07:54
#> 3: POWERSTEP_LargeWWTP 0b_Ref_High_C+N Main Net 11.10.2017 13:07:54
#> 4: POWERSTEP_LargeWWTP 0b_Ref_High_C+N Main Net 11.10.2017 13:07:54
#> 5: POWERSTEP_LargeWWTP 0b_Ref_High_C+N Main Net 11.10.2017 13:07:54
#> 6: POWERSTEP_LargeWWTP 0b_Ref_High_C+N Main Net 11.10.2017 13:07:54
#>                                product
#>                                 <char>
#> 1: VOL [A1 (P3 -> T01)] (75.000,00 m3)
#> 2: VOL [A1 (P3 -> T01)] (75.000,00 m3)
#> 3: VOL [A1 (P3 -> T01)] (75.000,00 m3)
#> 4: VOL [A1 (P3 -> T01)] (75.000,00 m3)
#> 5: VOL [A1 (P3 -> T01)] (75.000,00 m3)
#> 6: VOL [A1 (P3 -> T01)] (75.000,00 m3)
#>                                                           lci_method  phase
#>                                                               <char> <char>
#> 1: ReCiPe Midpoint (H) w/o LT - climate change w/o LT, GWP100 w/o LT  Other
#> 2: ReCiPe Midpoint (H) w/o LT - climate change w/o LT, GWP100 w/o LT  Other
#> 3: ReCiPe Midpoint (H) w/o LT - climate change w/o LT, GWP100 w/o LT  Other
#> 4: ReCiPe Midpoint (H) w/o LT - climate change w/o LT, GWP100 w/o LT  Other
#> 5: ReCiPe Midpoint (H) w/o LT - climate change w/o LT, GWP100 w/o LT  Other
#> 6: ReCiPe Midpoint (H) w/o LT - climate change w/o LT, GWP100 w/o LT  Other
#>                        process material_type
#>                         <char>        <char>
#> 1:       T03: Activated sludge           Bad
#> 2:              T06: CHP plant           Bad
#> 3:              T06: CHP plant           Bad
#> 4:             T07: Centrifuge           Bad
#> 5: T11: Electricity WWTP (RER)           Bad
#> 6: T11: Electricity WWTP (RER)           Bad
#>                                                               material
#>                                                                 <char>
#> 1:                               Dinitrogen monoxide [air/unspecified]
#> 2:                 Dinitrogen monoxide [air/urban air close to ground]
#> 3:                 Methane, non-fossil [air/urban air close to ground]
#> 4:                               Methane, non-fossil [air/unspecified]
#> 5: Carbon dioxide, fossil [air/lower stratosphere + upper troposphere]
#> 6:      Carbon dioxide, fossil [air/non-urban air or from high stacks]
#>        quantity      unit
#>           <num>    <char>
#> 1: 6.656436e+03 kg CO2-Eq
#> 2: 1.041035e+02 kg CO2-Eq
#> 3: 5.003880e+02 kg CO2-Eq
#> 4: 2.809735e+02 kg CO2-Eq
#> 5: 2.282481e-05 kg CO2-Eq
#> 6: 1.010088e+04 kg CO2-Eq

umberto10_csv_dir <- system.file("extdata/umberto-lca+_v10.1.0.3.146", 
package = "kwb.umberto")
umberto10_rawdata <- kwb.umberto::import_rawdata(csv_dir = umberto10_csv_dir)
#> Importing csv file 'D:/a/_temp/Library/kwb.umberto/extdata/umberto-lca+_v10.1.0.3.146/smartech2_model-v0.1.0_input-v0.3.1.csv'
#>  Using "','" as decimal and "'.'" as grouping mark. Use `read_delim()` for more control.
#> Rows: 8456 Columns: 15
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ";"
#> chr (14): Project, Model, Net, Timestamp, Product, Product Name, Product Arr...
#> dbl  (1): Quantity
#> 
#>  Use `spec()` to retrieve the full column specification for this data.
#>  Specify the column types or set `show_col_types = FALSE` to quiet this message.
head(umberto10_rawdata)
#> # A tibble: 6 × 15
#>   project               model net   timestamp product product_name product_arrow
#>   <chr>                 <chr> <chr> <chr>     <chr>   <chr>        <chr>        
#> 1 smartech2_model-v0.1… 0_Re… Main… 12.09.20… VOL [A… VOL          A1 (P3 -> T0…
#> 2 smartech2_model-v0.1… 0_Re… Main… 12.09.20… VOL [A… VOL          A1 (P3 -> T0…
#> 3 smartech2_model-v0.1… 0_Re… Main… 12.09.20… VOL [A… VOL          A1 (P3 -> T0…
#> 4 smartech2_model-v0.1… 0_Re… Main… 12.09.20… VOL [A… VOL          A1 (P3 -> T0…
#> 5 smartech2_model-v0.1… 0_Re… Main… 12.09.20… VOL [A… VOL          A1 (P3 -> T0…
#> 6 smartech2_model-v0.1… 0_Re… Main… 12.09.20… VOL [A… VOL          A1 (P3 -> T0…
#> # ℹ 8 more variables: product_flow_amount <chr>, lci_method <chr>, phase <chr>,
#> #   process <chr>, material_type <chr>, material <chr>, quantity <dbl>,
#> #   unit <chr>