diff --git a/R/as.s2dv_cube.R b/R/as.s2dv_cube.R index c504fbcc69ed170e96be0c510830d163712986ff..1b4c42751b1845bf90afedb6bbad4b6dd90c5156 100644 --- a/R/as.s2dv_cube.R +++ b/R/as.s2dv_cube.R @@ -327,13 +327,13 @@ as.s2dv_cube <- function(object, remove_attrs_coords = FALSE, if (!remove_attrs_coords) attr(result$coords[[dat_dim]], 'indices') <- FALSE } for (i in 2:length(names(FileSelector))) { - if (!is.null(lon_name_dat)) { + if (!(length(lon_name_dat) == 0L)) { if (any(result$coords[[lon_name_dat]] != as.vector(attributes(object)$Variables[[names(FileSelector)[i]]][[lon_name_dat]]))) { warning("'lon' values are different for different datasets. ", "Only values from the first will be used.") } } - if (!is.null(lat_name_dat)) { + if (!(length(lat_name_dat) == 0L)) { if (any(result$coords[[lat_name_dat]] != as.vector(attributes(object)$Variables[[names(FileSelector)[i]]][[lat_name_dat]]))) { warning("'lat' values are different for different datasets. ", "Only values from the first will be used.")