https://github.com/cran/kdevine
Tip revision: 7014bdb654eb0d5b3d69b57597f36f97eae8a916 authored by Thomas Nagler on 27 April 2017, 20:42:58 UTC
version 0.4.0
version 0.4.0
Tip revision: 7014bdb
extract_names.R
extract_nums <- function(lst){
unlist(sapply(lst,
function(x)
ifelse(length(x) > 2,
x[[3]]$name,
x[[2]])))
}
extract_all_nums<- function(lst){
len <- max(which(substr(names(lst), 1, 1) == "T"))
sapply(lst[1:len], function(x) extract_nums(x))
}
### naming in RVine routine
naming <- function(numb){
bef <- paste(as.character(numb[2]),
as.character(numb[1]),
sep=",",
collapse="")
aft <- if(length(numb) > 2){
gsub(" ",
",",
do.call(paste, as.list(as.character(numb[3:length(numb)]))))
} else ""
sep <- if(length(numb) > 2) " ; " else ""
paste(bef, aft, sep=sep, collapse="")
}
split_num <- function(x){
unlist(lapply(strsplit(x, " ; "), strsplit, split = ","))
}
split_name <- function(x){
unlist(lapply(strsplit(x, " ; ", fixed = TRUE), strsplit, split = ","))
}