Skip to content
Snippets Groups Projects
Commit 8649822f authored by clblatte's avatar clblatte
Browse files

add xlsx output overview table and modification s on Main skript

parent 899fc1c4
No related branches found
No related tags found
No related merge requests found
......@@ -31,10 +31,40 @@ db_names <- c("MV_Hartola",
### Restructure the SQL database: querry that creates the final UNIT table, which contains indicators over time under regimes
#
# !!! Only needed if the DB is read/loaded for the first time !!!
#
# source(paste0(path, "structure_SIMO_rslDB_FBE.R"))
# !!! Only needed if the DB is read/loaded for the first time. !!!
# source(paste0(path, "structure_SIMO_rslDB_FBE.R")) Afterwards, you can exclude this line with: #
### Import the restructured SIMO data (from UNIT table) in the R-environment
# It gives a single dataframe for each database named by "db_names" AND an overall dataframe calles rslt
source(paste0(path, "loadDB.R"))
# It gives a single dataframe for each database named by "rsl_db_names.csv" AND an overall dataframe called "rslt_all.csv"
# Select columns that should be importat from the SQL table UNIT (created before by script structure_SIMO_rslDB)
# An overview on all available SIMO outcomes can be found under: params/Overview_outcomes_SIMO.xlsx
columns <- paste0("id,
year,
branch,
branch_desc,
branching_group,
Age,
area,
cash_flow,
V_total_deadwood,
BA,
V,
N,
H_dom,
D_gm,
Harvested_V,
Biomass,
income_biomass,
CARBON_STORAGE")
### !!! Needed if the DB is read/loaded for the first time, since dataframes are also stored as csv-file under "output". !!!
# source(paste0(path, "loadDB.R")) # Afterwards, you can also exclude this line with: #
### The single csv can later also be loaded into the R-environment with:
rslt <- read.csv(paste0(path, "output/rslt_all.csv"), sep = ";", header = TRUE, stringsAsFactors = FALSE)
......@@ -15,28 +15,6 @@ library(dplyr)
### Select the columns that should be importat from the table UNIT (which was created before via a querry - script structure_SIMO_rslDB)
# An overview on all available outcomes can be found under: params/Overview_outcomes_SIMO
columns <- paste0("id,
year,
branch,
branch_desc,
branching_group,
Age,
area,
cash_flow,
V_total_deadwood,
BA,
V,
N,
H_dom,
D_gm,
Harvested_V,
Biomass,
income_biomass,
CARBON_STORAGE")
# Variant 1: create a single dataframe for each SQL Database (selected columns of table UNIT)
# Dataframes are given the names of the DB and column "test" is added with the name of the DB
......@@ -52,7 +30,7 @@ for (name in db_names){
write.table(rsl, paste0(path, "output/rsl_",name,".csv" ), sep = ";", row.names = F, col.names = TRUE)
# assign( paste("rsl",name, sep="_"), rsl)
assign( paste("rsl",name, sep="_"), rsl)
rm(db, rsl)
}
......
File added
......@@ -16,6 +16,8 @@ path <- paste0(getwd(),"/")
source(paste0(path,"main.R"))
library(tidyr)
library(dplyr)
library(ggplot2)
library(knitr)
library(kableExtra)
......
......@@ -385,7 +385,7 @@ $(document).ready(function () {
 
<h1 class="title toc-ignore">Overview simulated data</h1>
<h4 class="author">CB</h4>
<h4 class="date">09 12, 2019</h4>
<h4 class="date">11 12, 2019</h4>
 
</div>
 
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment