Skip to content

Add user defined reordering feature required for Fabian's second use case (extended version) #2

Description

@mrustl

Use case A:
Y:\Z-Exchange\Fabian\Basis_Variante

data is grouped by: model

group_data <- function(raw_data,
                       grouping_paras = c("lci_method", "model", "process", "unit"),
                       grouping_function = "sum") {

Use case B:
Y:\Z-Exchange\Fabian\Erweiterte_Variante

data is grouped by: product

group_data <- function(raw_data,
                       grouping_paras = c("lci_method", "product", "process", "unit"),
                       grouping_function = "sum")

additional function for reordering grouped data based on user defined csv configuration file:

product_meta <- data.frame(product = names(data_pivot)[3:ncol(data_pivot)], 
                            priority = NA)

product_meta <- data.frame(product = names(data_pivot)[3:ncol(data_pivot)], 
                            priority = NA)

write.csv2(product_meta,file = "product_meta.csv",row.names = FALSE)

product_meta <- read.csv2(file = "product_meta.csv",
                          stringsAsFactors = FALSE) %>%  
                dplyr::arrange_("priority")

data_pivot_ordered <- data_pivot[,c(names(data_pivot)[1:2],product_meta$product)] 


data_pivot_list <- create_pivot_list(data_pivot_ordered)

Source code for both versions:
data-processing-r.zip

This function needs to be integrated in the R package and documented. Then after testing if the results are equal to the R scripts before a first release of kwb.umberto can be published.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesttestTest something

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions