From 2b83730eac6df953871ecc810afd746a07d3e811 Mon Sep 17 00:00:00 2001 From: Diego Olivo Date: Thu, 1 Dec 2022 14:14:52 -0700 Subject: [PATCH 1/3] added hello world --- DESCRIPTION | 4 +++- hello.R | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 hello.R diff --git a/DESCRIPTION b/DESCRIPTION index c201fd8..f068b25 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -8,4 +8,6 @@ Description: What the package does (one paragraph). License: MIT + file LICENSE Encoding: UTF-8 Roxygen: list(markdown = TRUE) -RoxygenNote: 7.0.0 +RoxygenNote: 7.2.2 +Imports: + glue diff --git a/hello.R b/hello.R new file mode 100644 index 0000000..c64c9b1 --- /dev/null +++ b/hello.R @@ -0,0 +1,11 @@ + +#' @param world To whom the message is directed +#' @return A character vector +#' @export + +hello_world <- function(workd = "World" ) { + glue::glue("Hello {world}") +} + +devtools::document() +devtools::check() From 3d647da6fc3e37041b6cdf41225a3f8eb2e028a1 Mon Sep 17 00:00:00 2001 From: Diego Olivo Date: Wed, 7 Dec 2022 16:27:26 -0700 Subject: [PATCH 2/3] Genetic model for R class --- hello.R => Genetic_model.R | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename hello.R => Genetic_model.R (100%) diff --git a/hello.R b/Genetic_model.R similarity index 100% rename from hello.R rename to Genetic_model.R From 62b1bf0efd4ecbfebe682967759efe0e7ee235f3 Mon Sep 17 00:00:00 2001 From: Diego Olivo Date: Wed, 7 Dec 2022 16:35:52 -0700 Subject: [PATCH 3/3] Code for genetic model team --- Genetic_model.R | 57 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 7 deletions(-) diff --git a/Genetic_model.R b/Genetic_model.R index c64c9b1..cf96eb7 100644 --- a/Genetic_model.R +++ b/Genetic_model.R @@ -1,11 +1,54 @@ +library(tidyverse) -#' @param world To whom the message is directed -#' @return A character vector -#' @export +#initialize the starting variables and their parameters + + +#three human populations with three different genotypes +H1 = 0.3 +H2 = 0.35 +H3 = 0.15 + +Z = 0.20 + +#infection rate for each of the three genotype populations +I1 = 0.8 +I2 = 0.3 +I3 = 0.15 + +#three baby populations for each human genotype +h1 = round(H1/(H1+H2+H3),2) +h2 = round(H2/(H1+H2+H3),2) +h3 = round(H3/(H1+H2+H3),2) + +zombieTable <- setNames(data.frame(matrix(ncol = 6, nrow = 7)), c("0","1", "2", "3","4","5")) +row.names(zombieTable) <- c("H1", "H2","H3","Z", "h1","h2","h3") + +initialValues <- c(H1,H2,H3,Z,h1,h2,h3) + +for (x in 1:7) { + zombieTable[x,1] <- initialValues[x] -hello_world <- function(workd = "World" ) { - glue::glue("Hello {world}") } -devtools::document() -devtools::check() +for (j in 1:5) { + + H1 = round(h1*(1-I1*Z),2) + H2 = round(h2*(1-I2*Z),2) + H3 = round(h3*(1-I3*Z),2) + + zombieTable[1, j+1] <- H1 + zombieTable[2, j+1] <- H2 + zombieTable[3, j+1] <- H3 + + Z = round((((h1*I1) + (h2*I2) + (h3*I3))*Z),2) + zombieTable[4, j+1] <- Z + + h1 = round(H1/(H1+H2+H3),2) + h2 = round(H2/(H1+H2+H3),2) + h3 = round(H3/(H1+H2+H3),2) + + zombieTable[5, j+1] <- h1 + zombieTable[6, j+1] <- h2 + zombieTable[7, j+1] <- h3 + +}