resultlist <- function(x) {
vector <- character()
for(cov in x) {
if(unlist(gregexpr(",", cov))[1]!=-1){
idxes <- unlist(gregexpr(",", cov))
len <- length(idxes)+1
if(idxes[1]!=-1) {
start <- 1
for(idx in idxes) {
vector <- c(vector, str_trim(substr(cov, start, idx-1)))
start <- idx+1
}
vector <- c(vector, str_trim(substr(cov, start, 100000L)))
}
}
else {
# if result comes with just a single cause
vector <- c(vector, str_trim(cov))
}
}
return(vector)
}
myreslength <- function(x) {
vector <- character()
for(cov in x) {
if(unlist(gregexpr(",", cov))[1]!=-1){
idxes <- unlist(gregexpr(",", cov))
len <- length(idxes)+1
vector <- c(vector, len)
}
else {
# if result comes with just a single cause
vector <- c(vector, 1)
}
}
return(vector)
}
convertTo2digitMonth <- function(x) {
vector <- character()
for(cov in x) {
if(nchar(cov)==1) cov = paste("0",cov,sep="")
vector <- c(vector, cov)
}
return(vector)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.