Skip to contents

Write results to EXCEL

Usage

write_xlsx(data_pivot_list, path = "results.xlsx")

Arguments

data_pivot_list

a list as retrieved by function create_pivot_list()

path

relative or full path to be used for exporting the results to EXCEL (default: "results.xlsx")

Value

writes results in EXCEL file defined in "path", where each sheet

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.
umberto7_data_grouped <- kwb.umberto::group_data(umberto7_rawdata)
umberto7_data_pivot <- kwb.umberto::pivot_data(umberto7_data_grouped)
umberto7_data_pivot_list <- kwb.umberto::create_pivot_list(umberto7_data_pivot)
#> Joining with `by = join_by(lci_method, process)`
#> Joining with `by = join_by(lci_method, process)`
#> Joining with `by = join_by(lci_method, process)`
#> Joining with `by = join_by(lci_method, process)`
#> Joining with `by = join_by(lci_method, process)`
#> Joining with `by = join_by(lci_method, process)`
#> Joining with `by = join_by(lci_method, process)`
#> Joining with `by = join_by(lci_method, process)`
#> Joining with `by = join_by(lci_method, process)`
export_path <- file.path(getwd(), "umberto7_results.xlsx")
print(sprintf("Exporting aggregated results to %s", export_path))
#> [1] "Exporting aggregated results to C:/Users/RUNNER~1/AppData/Local/Temp/RtmpgX0H5o/file10fc7b92182a/dev/reference/umberto7_results.xlsx"
write_xlsx(umberto7_data_pivot_list, path = export_path)

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.
umberto10_data_grouped <- kwb.umberto::group_data(umberto10_rawdata)
umberto10_data_pivot <- kwb.umberto::pivot_data(umberto10_data_grouped)
umberto10_data_pivot_list <- kwb.umberto::create_pivot_list(umberto10_data_pivot)
#> Joining with `by = join_by(lci_method, process)`
#> Joining with `by = join_by(lci_method, process)`
#> Joining with `by = join_by(lci_method, process)`
#> Joining with `by = join_by(lci_method, process)`
#> Joining with `by = join_by(lci_method, process)`
#> Joining with `by = join_by(lci_method, process)`
#> Joining with `by = join_by(lci_method, process)`
#> Joining with `by = join_by(lci_method, process)`
#> Joining with `by = join_by(lci_method, process)`
export_path <- file.path(getwd(), "umberto10_results.xlsx")
print(sprintf("Exporting aggregated results to %s", export_path))
#> [1] "Exporting aggregated results to C:/Users/RUNNER~1/AppData/Local/Temp/RtmpgX0H5o/file10fc7b92182a/dev/reference/umberto10_results.xlsx"
write_xlsx(umberto10_data_pivot_list, path = export_path)