Running examples in ‘graph4lg-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: convert_cd
> ### Title: Fit a model to convert cost-distances into Euclidean distances
> ### Aliases: convert_cd
> 
> ### ** Examples
> 
> path <- system.file('extdata', package = 'graph4lg')
> links <- "liens_rast2_1_11_01_19-links"
> graph <- graphab_to_igraph(dir_path = path,
+                            links = links,
+                            fig = FALSE)
OGR data source with driver: ESRI Shapefile 
Source: "/home/hornik/tmp/R.check/r-devel-gcc/Work/build/Packages/graph4lg/extdata", layer: "patches"
with 50 features
It has 4 fields
OGR data source with driver: ESRI Shapefile 
Source: "/home/hornik/tmp/R.check/r-devel-gcc/Work/build/Packages/graph4lg/extdata", layer: "liens_rast2_1_11_01_19-links"
with 1225 features
It has 5 fields
Warning in if (class(edges) == "formula") { :
  the condition has length > 1 and only the first element will be used
> mat_ld <- igraph::get.adjacency(graph, attr = "weight",
+                                 type = "both", sparse = FALSE )
> pts <- rgdal::readOGR(dsn = path, layer = "patches")
OGR data source with driver: ESRI Shapefile 
Source: "/home/hornik/tmp/R.check/r-devel-gcc/Work/build/Packages/graph4lg/extdata", layer: "patches"
with 50 features
It has 4 fields
> pts <- data.frame(sp::coordinates(pts))
> pts$ID <- as.character(1:50)
> names(pts) <- c("x", "y", "ID")
> pts <- pts[, c("ID", "x", "y")]
> 
> mat_euc <- suppressWarnings(mat_geo_dist(data= pts,
+       ID = "ID",
+       x = "x",
+       y = "y"))
Coordinates were treated as projected coordinates. Check whether
              it is the case.
>  to_convert <- c(15000, 20000, 25000)
>  res <- convert_cd(mat_euc = mat_euc,
+  mat_ld = mat_ld, to_convert = to_convert)
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
graph4lg
 --- call from context --- 
convert_cd(mat_euc = mat_euc, mat_ld = mat_ld, to_convert = to_convert)
 --- call from argument --- 
if (class(mat_euc) != "matrix") {
    stop("'mat_euc' must be an object of class 'matrix'.")
} else if (class(mat_ld) != "matrix") {
    stop("'mat_ld' must be an object of class 'matrix'.")
} else if (!Matrix::isSymmetric(mat_euc)) {
    stop("'mat_euc' must be a symmetric pairwise matrix.")
} else if (!Matrix::isSymmetric(mat_ld)) {
    stop("'mat_ld' must be a symmetric pairwise matrix.")
}
 --- R stacktrace ---
where 1: convert_cd(mat_euc = mat_euc, mat_ld = mat_ld, to_convert = to_convert)

 --- value of length: 2 type: logical ---
[1] FALSE  TRUE
 --- function from context --- 
function (mat_euc, mat_ld, to_convert, method = "log-log", fig = TRUE, 
    line_col = "black", pts_col = "#999999") 
{
    if (class(mat_euc) != "matrix") {
        stop("'mat_euc' must be an object of class 'matrix'.")
    }
    else if (class(mat_ld) != "matrix") {
        stop("'mat_ld' must be an object of class 'matrix'.")
    }
    else if (!Matrix::isSymmetric(mat_euc)) {
        stop("'mat_euc' must be a symmetric pairwise matrix.")
    }
    else if (!Matrix::isSymmetric(mat_ld)) {
        stop("'mat_ld' must be a symmetric pairwise matrix.")
    }
    if (!all(row.names(mat_euc) == row.names(mat_ld))) {
        stop("'mat_euc' and 'mat_dist' must have the same row names.")
    }
    else if (!all(colnames(mat_euc) == colnames(mat_ld))) {
        stop("'mat_euc' and 'mat_ld' must have the same column names.")
    }
    df <- data.frame(euc = ecodist::lower(mat_euc), ld = ecodist::lower(mat_ld))
    if (method == "log-log") {
        if (nrow(df[which(df$euc == 0), ])) {
            message("Euclidean distances equal to zero were replaced by 1 before\n              computing the logarithm of the distances.")
            df[which(df$euc == 0), "euc"] <- 1
        }
        if (nrow(df[which(df$ld == 0), ])) {
            message("Landscape distances equal to zero were replaced by 1 before\n              computing the logarithm of the distances.")
            df[which(df$ld == 0), "ld"] <- 1
        }
        df$log_ld <- log(df$ld)
        df$log_euc <- log(df$euc)
        model <- stats::lm(data = df, formula = log_ld ~ log_euc)
        converted <- exp(stats::predict(model, newdata = data.frame(log_euc = log(to_convert))))
    }
    else if (method == "lm") {
        model <- stats::lm(data = df, formula = ld ~ euc)
        converted <- stats::predict(model, newdata = data.frame(euc = to_convert))
    }
    else {
        stop("You must specify a correct 'method' option ('log-log' or 'lm').")
    }
    names(converted) <- to_convert
    param <- model$coefficients
    names(param) <- c("Intercept", "Slope")
    r_sq <- as.numeric(summary(model)[8])
    names(r_sq) <- "Multiple R-squared"
    if (fig == FALSE) {
        list_res <- list(converted, param, r_sq)
        names(list_res) <- c("Converted values", "Model parameters", 
            "Model multiple R-squared")
    }
    else if (fig == TRUE) {
        df$predict <- stats::predict(model)
        if (method == "log-log") {
            df2 <- data.frame(log_euc = log(to_convert), log_conv = log(converted))
            plot <- ggplot() + geom_point(data = df, aes_string(x = "log_euc", 
                y = "log_ld"), color = pts_col) + geom_line(data = df, 
                aes_string(x = "log_euc", y = "predict"), color = line_col) + 
                geom_point(data = df2, aes_string(x = "log_euc", 
                  y = "log_conv"), color = "black", size = 3) + 
                labs(x = "log ( Euclidean distance )", y = "log ( Landscape distance )") + 
                theme_bw()
        }
        else {
            df2 <- data.frame(euc = to_convert, conv = converted)
            plot <- ggplot() + geom_point(data = df, aes_string(x = "euc", 
                y = "ld"), color = pts_col) + geom_line(data = df, 
                aes_string(x = "euc", y = "predict"), color = line_col) + 
                geom_point(data = df2, aes_string(x = "euc", 
                  y = "conv"), color = "black", size = 3) + labs(x = "Euclidean distance", 
                y = "Landscape distance") + theme_bw()
        }
        list_res <- list(converted, param, r_sq, plot)
        names(list_res) <- c("Converted values", "Model parameters", 
            "Model multiple R-squared", "Plot")
    }
    else {
        stop("'fig' must be logical (TRUE or FALSE).")
    }
    return(list_res)
}
<bytecode: 0x564423046518>
<environment: namespace:graph4lg>
 --- function search by body ---
Function convert_cd in namespace graph4lg has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1