https://github.com/cran/kdevine
Tip revision: 950ccc0c0c9d3f6c25ac1cfbddbf65faf191659d authored by Thomas Nagler on 17 December 2018, 15:00:03 UTC
version 0.4.2
version 0.4.2
Tip revision: 950ccc0
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 = ","))
}