library(vroom)
library(fs)
library(dplyr)
library(stringr)
library(forcats)
files = dir_ls(path = "data-raw/dystonia", glob = "*plate*.csv")
biomarkerData = vroom(files, skip = 1, id = "Sourcefile") %>% select(Sample, Assay, Well, Concentration, `Calc. Concentration`, Sourcefile) %>% rename(`Biomarker Level` = `Calc. Concentration`)
groupData = vroom("data-raw/dystonia/group.csv") %>% mutate(group = ifelse(group == "control", "Control", group)) %>% rename(Group = group) %>% mutate(Group = ifelse(Group == "CD/Hypothyroi", "CD/Hypothyroid", Group)) %>% mutate(Sample = paste("U",str_pad(`sample#`,3, pad="0"), sep=""))
# It is unclear how to use the calibration information provided for reference subjects.
# It appears that the `Calc. Concentration` field is calculated based on this reference data, and therefore that these values probably do not need to be considered further.
# Therefore we will exclude reference cases.
dystonia = full_join(biomarkerData, groupData, by = "Sample") %>%
filter(!grepl("S0", Sample)) %>%
mutate(CD = ifelse(grepl("CD", Group), "CD", ifelse(is.na(Group), NA_character_, "Control"))) %>%
mutate(Group = ifelse(Group == "CD", "Cervical Dystonia (CD)", Group)) %>%
mutate(Group = factor(Group, levels = c("Cervical Dystonia (CD)", "CD/Hypothyroid", "Control"))) %>%
mutate(CD = ifelse(CD == "CD", "Cervical Dystonia (CD)", CD)) %>%
mutate(CD = factor(CD, levels = c("Cervical Dystonia (CD)", "Control"))) %>%
mutate(CD = fct_explicit_na(CD)) %>% mutate(Group = fct_explicit_na(Group)) %>%
select(CD, Group, Assay, Sample, `Biomarker Level`)
# copy resulting dataset into /data directory
usethis::use_data(dystonia, overwrite = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.