-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Whenever the 'patient' column is read from the samples.csv, they are changed to a factor. This is fine, but the factor levels are reordered according to the contents of the column, sorted or what not. We should relabel the factor levels to order that the samples were input. Example below:
test <- c("pHIVP12_d0", "pHIVP12_d7", "pHIVP12_d14", "pHIVP12_d21", "pHIVP12_d28")
factor(test)
[1] pHIVP12_d0 pHIVP12_d7 pHIVP12_d14 pHIVP12_d21 pHIVP12_d28
Levels: pHIVP12_d0 pHIVP12_d14 pHIVP12_d21 pHIVP12_d28 pHIVP12_d7
unique(test)
[1] "pHIVP12_d0" "pHIVP12_d7" "pHIVP12_d14" "pHIVP12_d21" "pHIVP12_d28"
factor(test, levels=unique(test))
[1] pHIVP12_d0 pHIVP12_d7 pHIVP12_d14 pHIVP12_d21 pHIVP12_d28
Levels: pHIVP12_d0 pHIVP12_d7 pHIVP12_d14 pHIVP12_d21 pHIVP12_d28