inst/data-raw/process/Core_Autoantibody/process.R

library(data.table)

# Diabetes Info
dinfo <- fread("DiabetesInfo.tsv")
dinfo <- dinfo[, .(nPODCaseID, diabetes_Duration_yrs, dataSetsAge_At_Onset_QuerySnapshotAgeAtOnset, oppc_C_peptideR, oppc_HbA1cR, oppc_peakGluc)]
setnames(dinfo, c("ID", "db.duration", "age.onset", "Cpeptide", "HbA1c", "peak.gluc"))
dinfo[, ID := as.numeric(ID)]
dinfo <- dinfo[!is.na(ID)]
dinfo[Cpeptide == "Less than .05", Cpeptide := "0"] # The most likely value is 0
dinfo[Cpeptide == "Less than .02", Cpeptide := "0"] # The most likely value is 0
for(col in c("Cpeptide", "peak.gluc")) set(dinfo, j = col, value = as.numeric(dinfo[[col]]))
write.table(dinfo, "DiabetesInfo_ref.tsv", sep = "\t", row.names = F)
avucoh/nPOD documentation built on April 1, 2020, 5:24 p.m.