1 trimFromStart <- function(sample, trimCharacters)
3 if(startsWith(sample, trimCharacters))
4 sample <- substr(sample, nchar(trimCharacters) + 1, nchar(sample))
9 trimFromEnd <- function(sample, trimCharacters)
11 if(endsWith(sample, trimCharacters))
12 sample <- substr(sample, 0, nchar(sample) - nchar(trimCharacters))
17 RListToPythonList <- function(RList, separator = ", ")
19 pythonArrayContent <- sapply(RList, function(elementInList)
21 if((is.vector(elementInList) || is.list(elementInList)) &&
22 length(elementInList) > 1)
24 return(RListToPythonList(elementInList, separator))
28 return(paste0("\"", elementInList, "\""))
32 pythonArray <- paste0("[", paste0(pythonArrayContent, collapse = separator), "]")
36 appendToStartIfNotExist <- function(sample, characters)
38 if(!startsWith(sample, characters))
39 sample <- paste0(characters, sample)
44 splitToPathAndName = function(path)
46 path <- appendToStartIfNotExist(path, "/")
47 components <- unlist(stringr::str_split(path, "/"))
49 nameAndPath$name <- components[length(components)]
50 nameAndPath$path <- trimFromStart(paste0(components[-length(components)], collapse = "/"),