Skip to content

Commit

Permalink
@marruett some minor changes in the code and some early guidance on h…
Browse files Browse the repository at this point in the history
…ow we can create a nice supplementary markdown from your DA function.
  • Loading branch information
CWWhitney committed Jan 25, 2019
1 parent 46256ec commit 2d5b6e7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 17 deletions.
7 changes: 4 additions & 3 deletions Calluna_low_prophy_V1.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ library(dplyr)
library(Surrogate)
library(MASS)

setwd("C:/Users/ZEF/Documents/GitHub/Calluna_prophy_new_model")
setwd("C:/Users/ZEF/Documents/GitHub/Calluna_prophy_new_model") #Check getwd() and see that this is always the case

Calluna_low_prophy_V1 <- function(x, varnames){

#### Calculate the plant amount of whole production area ####
#### Calculate the number of plants in the whole production area ####
original_plant_number <- production_area * plants_per_ha

# Define risky months (May to August)
Expand Down Expand Up @@ -72,7 +72,8 @@ Calluna_low_prophy_V1 <- function(x, varnames){


# Define effect of NORMAL prophylactic pesticide application (potential to reduce fungus onset)
# Estimated effect of fungus reduce potential are interlinked with each number of application per month
# Estimated effect of fungus reduce potential are interlinked with each number of application per month
library(magrittr)
effect_application_N <- effect_application_N %>%
replace(., effect_application_N==1, effect_one_prophy_application) %>%
replace(., effect_application_N==2, effect_two_prophy_application) %>%
Expand Down
38 changes: 24 additions & 14 deletions Calluna_model.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,40 @@ library(DAutilities)
library(Surrogate)
library(decisionSupport)
library(tidyverse)
library(knitr)
library(kableExtra)
options(knitr.table.format = "html")
```

## R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
The input table is ...
```{r}
input_table <- read.csv("Calluna_low_prophy.csv")
input_table <-select(input_table, -X, -General.variables, - Description, - median)
kable(input_table)%>%
kable_styling(bootstrap_options = c("striped", "hover"))
```

Load the input table and make variables. The rest of the calculations in this doument will be based on random draws from the distributions in the input table `Calluna_low_prophy.csv`.
```{r}
summary(cars)
```
input_table <- "Calluna_low_prophy.csv"
## Including Plots
make_variables <- function(est,n=1)
{ x <- random(rho=est, n=n)
for(i in colnames(x)) assign(i, as.numeric(x[1,i]),envir = .GlobalEnv)}
You can also embed plots, for example:
make_variables(estimate_read_csv(input_table))
```{r pressure, echo=FALSE}
plot(pressure)
```

Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
## Calluna function in `decisionSupport`

Calculate the number of plants in the whole production area
```{r}
original_plant_number <- production_area * plants_per_ha
original_plant_number
```
Define risky months (May to August)
```{r}
weather_arguments_for_infection <- c(0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0)
```

0 comments on commit 2d5b6e7

Please sign in to comment.