meltDT <- function(DT){
## Determine last column before runs start
minimumCol <- grep("ExactMass", colnames(DT))
## Melt data table; sample runs=variable
DT <- melt(DT, measure.vars = c(colnames(DT)[(minimumCol+1):(length(DT))]))
DT<- DT[!is.na(value)]
DT[which(DT[, GeneralID == "STANDARD"]), GeneralID := "Standard"]
num <- grep("Structural.ID.by.", colnames(DT))
setnames(DT, num, "Validation")
## Split sample run names into relevant information
DT <- DT[, c("run", "project", "matrix", "method") := tstrsplit(variable, ";_;")[1:4]]
DT[, variable := NULL]
return(DT)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.