---
title: "Macro Simulation (Caianim, 2016)"
author: "Sérgio Rivero"
date: "`r Sys.time()`"
output:
  html_document:
    df_print: paged
  pdf_document: default

---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE, message=FALSE, warning = FALSE, eval = TRUE)

### Generating the simulation Results
rm(list=ls())
```


```{r loadLibs}

### Getting the Libraries
library(tidyverse)

```


```{r setupDirs}

### Setting up the Directories
i  <-  "runs"
o  <-  "results"
```



```{r getFiles}

### Getting the files 
csv_files <- fs::dir_ls(i, regexp = "macro_Caiani_HH*")

```



```{r generatingDF}

### Generating runs dataframe

runs_df  <- csv_files %>%
    map_dfr(read_csv)
runs_df_or  <-  runs_df
runs_df  <- runs_df[complete.cases(runs_df),]



```


```{r grafsFromRunDF}
## Some Graphs

ggplot(runs_df, aes(y = consumption, color = as.factor(employed))) +
    geom_boxplot()


ggplot(runs_df, aes(y = total_cash, color = as.factor(employed))) +
    geom_boxplot()

```







```{r graphsFromMeans}


ggplot(runs_df, aes(x = step, y = consumption)) +
    geom_line()

ggplot(runs_df, aes(x = step, y = total_cash)) +
    geom_line()
   

ggplot(runs_df, aes(x = consumption, y = total_cash)) +
    geom_point()

ggplot(runs_df, aes(x = total_cash)) +
    geom_histogram()

ggplot(runs_df, aes(x = consumption)) +
    geom_histogram()


```
