Giter Club home page Giter Club logo

kwb.umberto's Introduction

R-CMD-check pkgdown codecov Project Status CRAN_Status_Badge R-Universe_Status_Badge DOI

kwb.umberto

Helper functions for data import, aggregation and visualisation of UMBERTO (https://www.ifu.com/umberto/) model output.

Installation

For details on how to install KWB-R packages checkout our installation tutorial.

### Optionally: specify GitHub Personal Access Token (GITHUB_PAT)
### See here why this might be important for you:
### https://kwb-r.github.io/kwb.pkgbuild/articles/install.html#set-your-github_pat

# Sys.setenv(GITHUB_PAT = "mysecret_access_token")

# Install package "remotes" from CRAN
if (! require("remotes")) {
  install.packages("remotes", repos = "https://cloud.r-project.org")
}

# Install KWB package 'kwb.umberto' from GitHub
remotes::install_github("KWB-R/kwb.umberto")

Documentation

Release: https://kwb-r.github.io/kwb.umberto

Development: https://kwb-r.github.io/kwb.umberto/dev

kwb.umberto's People

Contributors

hsonne avatar mrustl avatar

Watchers

 avatar  avatar  avatar  avatar

kwb.umberto's Issues

Add support for Umberto LCA+, v10.0.3.146)

As the output files created with the newer Umberto LCA+ (v10.0.3.146) the data import that which was designed for Umberto NXT (v7.1.0.13.503) with three variables less (see table below) in the output files needs to to be adapted.

col_names Umberto NXT, v7.1.0.13.503 Umberto LCA+, v10.0.3.146
project 1 1
model 1 1
net 1 1
timestamp 1 1
product 1 1
lci_method 1 1
phase 1 1
process 1 1
material_type 1 1
material 1 1
quantity 1 1
unit 1 1
product_name NA 1
product_arrow NA 1
product_flow_amount NA 1

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

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.

Fix `tidyverse` deprecated warnings

e.g. here: https://kwb-r.github.io/kwb.umberto/dev/articles/tutorial_umberto10.html#grouping

data_grouped <- kwb.umberto::[group_data](https://kwb-r.github.io/kwb.umberto/dev/reference/group_data.html)(rawdata)
#> Warning: `summarise_()` was deprecated in dplyr 0.7.0.
#> ℹ Please use `summarise()` instead.
#> ℹ The deprecated feature was likely used in the dplyr package.
#>   Please report the issue at <https://github.com/tidyverse/dplyr/issues>.
#> Warning: `group_by_()` was deprecated in dplyr 0.7.0.
#> ℹ Please use `group_by()` instead.
#> ℹ See vignette('programming') for more help
#> ℹ The deprecated feature was likely used in the dplyr package.
#>   Please report the issue at <https://github.com/tidyverse/dplyr/issues>.

grafik

Improve import_rawdata()

Improve the following section of import_rawdata() in order to avoid this:

Error in rbind(deparse.level, ...) : 
  Anzahl der Spalten der Argumente unterschiedlich

Code section:

for (csv_file in csv_files) {
  print(sprintf("Importing csv file '%s'", csv_file))
  tmp <- read_input(csv_file, ...) %>% janitor::clean_names()
  if (csv_file == csv_files[1]) {
    rawdata <- tmp
  }
  else {
    rawdata <- rbind(rawdata, tmp)
  }
}

Suggestions:

  • Check if columns differ and give a good message about it.
  • Use lapply and dplyr::bind_rows()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.