-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexercise1.Rmd
41 lines (33 loc) · 1001 Bytes
/
exercise1.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
---
title: "Statistical methods for assessing agreement between two methods of clinical measurement"
author: "Oxford IHTM Class 2024"
date: "`r Sys.Date()`"
output:
rmarkdown::html_document:
toc: true
keep_md: true
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
library(tidyverse)
```
```{r}
# Read the ba.dat dataset from the GitHub URL provided
ba_data <- read.table(file="https://raw.githubusercontent.com/OxfordIHTM/teaching_datasets/main/ba.dat", header=T, sep=" ")
# create function for Mean of the per subject measurements
calculate_mean <- function(x,y) {
avrg = (x+y)/2
avrg
}
ba_data$mean <- calculate_mean(ba_data$Wright,ba_data$Mini)
# create function for Difference between the per subject measurements
calculate_difference <- function(x,y) {
diff = x-y
diff
}
ba_data$difference <- calculate_difference(ba_data$Wright,ba_data$Mini)
# create function for Mean of the difference between the per subject measurements
```