<jupyter_start><jupyter_text>R using deSolve *Author*: <NAME>*Date*: 2018-07-12<jupyter_code>library(deSolve)
library(reshape2)
sir_ode <- function(times,init,parms){
  with(as.list(c(parms,init)), {
  # ODEs
  dS <- -beta*S*I
  dI <- beta*S*I-gamma*I
  dR <- gamma*I
  list(c(dS,dI,dR))
  })
}
parms <- c(beta=0.1,gamma=0.05)
init <- c(S=0.99,I=0.01,R=0) 
times <- seq(0,200,length.out=2001)
sir_out <- lsoda(init,times,sir_ode,parms)
sir_out_long <- melt(as.data.frame(sir_out),"time")<jupyter_output><empty_output><jupyter_text>Visualisation<jupyter_code>library(ggplot2)
ggplot(sir_out_long,aes(x=time,y=value,colour=variable,group=variable))+
  # Add line
  geom_line(lwd=2)+
  #Add labels
  xlab("Time")+ylab("Number")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1962864721485411, 'fraction_numerical': 0.04111405835543767, 'mean_word_length': 7.118279569892473, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '289874', 'license': 'MIT', 'n_tokens_mistral': 385, 'n_tokens_neox': 355, 'n_words': 35, 'path': 'notebooks/sir/r_desolve.ipynb', 'repo_name': 'epirecipes/epiRecipes', 'size': '759'}