knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
cvera
is an R package with a collection of utility R functions, useful in exploring Irish bTB datasets collated in CVERA.
You can install the development version of cvera from GitHub with:
# install.packages("devtools") devtools::install_github("044mj/cvera")
Extract yearly summary data and visualisations of reactor numbers from master_tb
dataset.
Read in data:
library(tidyverse) # if using readr::read_csv() they use first 1000 rows to guess type. # If the first 1,000 are missing, it will default to logical. GIF variables are missing in the first 1000 #because it only came in during May 2019 so include col_types for these variables: master_tb <- read_csv("data/master_tb_24_Mar_2022.csv", col_types = cols(.default = "?", gif_actual_date = col_date(), gif_cases = col_number(), sequence_number = col_character()))
Using all_cases_per_year
from cvera
package:
library(cvera) #drop 2022 figures as we only have 3 months worth of data cases <- all_cases_per_year(master_tb, drop_years = c(2022))
results in
cases_example <- readRDS("data/cases_example.rds") cases_example
p <- herd_plot(master_tb, "x1234567") #fake herd p
knitr::include_graphics("data/herd_plot_figure_2.png") #works in chunk but not when you render #knitr::include_graphics(path.expand("~/data/historic_gif_eamonn.png"))
bd_df <- bd_dataset_fun(master_tb)
bd_df <- bd_during_year(bd_df, years_to_check = c(2005:2006))
master_tb %>% filter(total_reactor_skin > 10) %>% core_vars()
bd_df <- bd_within_time_period(bd_df, 2016, 730)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.