Setup

Load packages

library(magrittr)    # A Forward-Pipe Operator for R
library(tidyr)       # Tidy Messy Data
#> 
#> Attaching package: 'tidyr'
#> The following object is masked from 'package:magrittr':
#> 
#>     extract
# library(knitr)       # A General-Purpose Package for Dynamic Report Generation in R
library(kableExtra)  # Construct Complex Table with 'kable' and Pipe Syntax

library(BAplot)

Set options

options(
  kable_styling_bootstrap_options = c("hover", "striped"),
  kable_styling_full_width = FALSE,
  kable_styling_position = "left"
)

Data

Prepare data: create columns for every method of measuring temperature.

tbl <- 
  temperature %>% 
  pivot_wider(names_from = method, values_from = temperature)

Compare methods

Compute statistics

ba_stat(data = tbl, var1 = infrared, var2 = rectal) %>% 
  pivot_wider(names_from = parameter, values_from = value) %>% 
  kable() %>% 
  kable_styling()
n bias lloa uloa bias.lcl lloa.lcl uloa.lcl bias.ucl lloa.ucl uloa.ucl
450 0.233689 -2.850304 3.317682 0.0879152 -3.099616 3.06837 0.3794627 -2.600992 3.566993

Visualize comparison

ba_plot(data = tbl, var1 = infrared, var2 = rectal)