R/internal_generic.R

Defines functions rep.JuliaObject

# the way devtools deal with unlist has bugs, so temporarily commented out
#
# unlist.JuliaObject <- function(x, recursive = TRUE, use.names = TRUE){
#     tryCatch(julia_call("JuliaCall.vcat", x),
#              warn = function(e){},
#              error = function(e) x
#     )
# }

#' @export
rep.JuliaObject <- function(x, times = 1, length.out = NA, each = 1, ...){
    if (!is.na(length.out)) {
        times <- ceiling(length.out / length(x))
        return(julia_call("JuliaCall.rep", x, as.integer(times))[1:length.out])
    }
    julia_call("JuliaCall.rep", x, as.integer(times))
}

Try the JuliaCall package in your browser

Any scripts or data that you put into this service are public.

JuliaCall documentation built on Sept. 8, 2022, 5:10 p.m.