View source: R/core_mutSignatures_scr_5.R
1 | extractXvarlinkData(xvarLink_data)
|
xvarLink_data |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (xvarLink_data)
{
tmpVars <- sub("^.*&var=[[:alnum:]]+(,.*)&.*$", "\1", xvarLink_data)
tmpVars[!grepl("^,.+", tmpVars)] <- NA
tmpVars <- strsplit(tmpVars, ",")
tmpVars <- do.call(rbind, lapply(1:length(tmpVars), function(i) {
if (tmpVars[[i]][1] == "" & length(tmpVars[[i]]) == 5) {
tmpVars[[i]][2:5]
}
else {
c(NA, NA, NA, NA)
}
}))
out <- data.frame(chrXvar = as.character(tmpVars[, 1]), posXvar = as.numeric(tmpVars[,
2]), refXvar = as.character(tmpVars[, 3]), mutXvar = as.character(tmpVars[,
4]), stringsAsFactors = FALSE)
return(out)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.