* using log directory ‘/data/gannet/ripley/R/packages/tests-LENGTH1/leafletR.Rcheck’ * using R Under development (unstable) (2022-04-26 r82260) * using platform: x86_64-pc-linux-gnu (64-bit) * using session charset: UTF-8 * using option ‘--no-stop-on-test-error’ * checking for file ‘leafletR/DESCRIPTION’ ... OK * checking extension type ... Package * this is package ‘leafletR’ version ‘0.4-0’ * checking package namespace information ... OK * checking package dependencies ... OK * checking if this is a source package ... OK * checking if there is a namespace ... OK * checking for executable files ... OK * checking for hidden files and directories ... OK * checking for portable file names ... OK * checking for sufficient/correct file permissions ... OK * checking whether package ‘leafletR’ can be installed ... [5s/13s] OK * checking package directory ... OK * checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking for left-over files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking R files for non-ASCII characters ... OK * checking R files for syntax errors ... OK * checking whether the package can be loaded ... OK * checking whether the package can be loaded with stated dependencies ... OK * checking whether the package can be unloaded cleanly ... OK * checking whether the namespace can be loaded with stated dependencies ... OK * checking whether the namespace can be unloaded cleanly ... OK * checking loading without being on the library search path ... OK * checking use of S3 registration ... OK * checking dependencies in R code ... OK * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking R code for possible problems ... [10s/25s] OK * checking Rd files ... OK * checking Rd metadata ... OK * checking Rd line widths ... OK * checking Rd cross-references ... OK * checking for missing documentation entries ... OK * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * checking Rd contents ... OK * checking for unstated dependencies in examples ... OK * checking examples ... ERROR Running examples in ‘leafletR-Ex.R’ failed The error most likely occurred in: > ### Name: leafletR-package > ### Title: Interactive Web-Maps Based on the Leaflet JavaScript Library > ### Aliases: leafletR-package leafletR > ### Keywords: package > > ### ** Examples > > # load example data (Fiji Earthquakes) > data(quakes) > > # store data in GeoJSON file (just a subset here) > q.dat <- toGeoJSON(data=quakes[1:99,], dest=tempdir(), name="quakes") Columns 1 (lat) and 2 (long) detected as latitude and longitude ----------- FAILURE REPORT -------------- --- failure: length > 1 in coercion to logical --- --- srcref --- : --- package (from environment) --- leafletR --- call from context --- dfToGeoJSON(data, name, dest, lat.lon, overwrite) --- call from argument --- is.na(data[, lat.lon[1]]) || is.na(data[, lat.lon[2]]) --- R stacktrace --- where 1: dfToGeoJSON(data, name, dest, lat.lon, overwrite) where 2: toGeoJSON(data = quakes[1:99, ], dest = tempdir(), name = "quakes") --- value of length: 99 type: logical --- [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [13] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [25] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [37] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [49] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [61] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [73] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [85] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [97] FALSE FALSE FALSE --- function from context --- function (data, name, dest, lat.lon, overwrite) { if (is(data, "tbl_df")) data <- as.data.frame(data) if (is.null(lat.lon)) { lat <- which(names(data) == intersect(names(data), c("y", "Y", "lat", "Lat", "LAT", "latitude", "Latitude", "LATITUDE"))[1]) lon <- which(names(data) == intersect(names(data), c("x", "X", "lon", "Lon", "LON", "long", "Long", "LONG", "longitude", "Longitude", "LONGITUDE"))[1]) if (length(lat) == 0 || length(lon) == 0) { lat.lon <- c(1, 2) message("Latitude and longitude not found - columns 1 (", names(data)[1], ") and 2 (", names(data)[2], ") taken instead") } else { lat.lon <- c(lat, lon) message("Columns ", lat, " (", names(data)[lat], ") and ", lon, " (", names(data)[lon], ") detected as latitude and longitude") } } if (length(lat.lon) != 2) stop("'lat.lon' must be a vector of two: c(latitude, longitude)") if (any(!is.numeric(lat.lon))) { if (!any(names(data) == lat.lon[1])) stop("Longitude column not found") if (!any(names(data) == lat.lon[2])) stop("Latitude column not found") lat.lon <- c(which(names(data) == lat.lon[1]), which(names(data) == lat.lon[2])) } if (is.na(data[, lat.lon[1]]) || is.na(data[, lat.lon[2]])) stop("Coordinate columns not found") for (i in 1:ncol(data)) { if (is(data[, i], "factor")) { data[, i] <- as.character(data[, i]) message("Column '", names(data[i]), "' converted from factor to character type") } } for (i in 1:ncol(data)) { data[, i] <- gsub("\n", "; ", data[, i]) } path <- paste0(file.path(dest, name), ".geojson") if (file.exists(path) && !overwrite) stop("Abort - file already exists\n") cat("{", file = path, sep = "\n") cat(" \"type\": \"FeatureCollection\",", file = path, append = TRUE, sep = "\n") cat(" \"features\": [", file = path, append = TRUE, sep = "\n") for (f in 1:nrow(data)) { cat(" {", file = path, append = TRUE, sep = "\n") cat(" \"type\": \"Feature\",", file = path, append = TRUE, sep = "\n") if (length(data) > 2) { cat(" \"properties\": {", file = path, append = TRUE, sep = "\n") dat <- data[f, -lat.lon] if (!is.data.frame(dat)) names(dat) <- names(data)[-lat.lon] if (length(dat) == 1) { cat(paste0(" \"", names(data)[-lat.lon], "\": \"", dat, "\"\n"), file = path, append = TRUE) } else { for (p in 1:length(dat)) { cat(paste0(" \"", names(dat)[p], "\": \"", dat[p], "\""), file = path, append = TRUE) if (p == length(dat)) cat("\n", file = path, append = TRUE) else cat(",", file = path, append = TRUE, sep = "\n") } } cat(" },", file = path, append = TRUE, sep = "\n") } cat(" \"geometry\": {", file = path, append = TRUE, sep = "\n") cat(" \"type\": \"Point\",", file = path, append = TRUE, sep = "\n") cat(paste0(" \"coordinates\": [", data[f, lat.lon[2]], ",", data[f, lat.lon[1]], "]"), file = path, append = TRUE, sep = "\n") cat(" }", file = path, append = TRUE, sep = "\n") if (f == nrow(data)) cat(" }", file = path, append = TRUE, sep = "\n") else cat(" },", file = path, append = TRUE, sep = "\n") } cat(" ]", file = path, append = TRUE, sep = "\n") cat("}", file = path, append = TRUE, sep = "\n") return(path) } --- function search by body --- Function dfToGeoJSON in namespace leafletR has this body. ----------- END OF FAILURE REPORT -------------- Fatal error: length > 1 in coercion to logical * checking PDF version of manual ... OK * checking for non-standard things in the check directory ... OK * checking for detritus in the temp directory ... OK * DONE Status: 1 ERROR See ‘/data/gannet/ripley/R/packages/tests-LENGTH1/leafletR.Rcheck/00check.log’ for details. Command exited with non-zero status 1 Time 2:05.26, 39.62 + 6.29