diff --git a/R/AddStep.R b/R/AddStep.R index f797e5704205b5cf01a1230dca077dd7e0700106..fece57225aec829518468ceb4911c4e90d5299f5 100644 --- a/R/AddStep.R +++ b/R/AddStep.R @@ -70,8 +70,12 @@ AddStep <- function(inputs, step_fun, ...) { workflow <- list(inputs = inputs, fun = step_fun, params = list(...)) - dimensions <- rep(NA, length(attr(step_fun, 'OutputDims')[[output]])) - names(dimensions) <- attr(step_fun, 'OutputDims')[[output]] + if (!is.null(attr(step_fun, 'OutputDims')[[output]])) { + dimensions <- rep(NA, length(attr(step_fun, 'OutputDims')[[output]])) + names(dimensions) <- attr(step_fun, 'OutputDims')[[output]] + } else { + dimensions <- NULL + } in_dims_to_remove <- which(names(all_input_dims) %in% new_target_dims) if (length(in_dims_to_remove) > 0) { dimensions <- c(dimensions, all_input_dims[-in_dims_to_remove]) diff --git a/R/ByChunks.R b/R/ByChunks.R index 6e7d64c91093bb3f5b20ac037ce0f041134543f2..a0c6c4a720ea96cdbffbe2addf5f958df3c6da98 100644 --- a/R/ByChunks.R +++ b/R/ByChunks.R @@ -121,7 +121,7 @@ ByChunks <- function(step_fun, cube_headers, ..., chunks = 'auto', # Check all input headers have matching dimensions cube_index <- 1 for (cube_header in cube_headers) { - if (!all(attr(cube_header, 'Dimensions') == unlist(all_dims)[names(attr(cube_header, 'Dimensions'))])) { + if (!all(attr(cube_header, 'Dimensions') == all_dims_merged[names(attr(cube_header, 'Dimensions'))])) { stop("All provided 'cube_headers' must have matching dimension lengths ", "with each other.") } @@ -158,9 +158,9 @@ ByChunks <- function(step_fun, cube_headers, ..., chunks = 'auto', stop("All values in parameter 'chunks' must be >= 1.") } for (chunk_spec in 1:length(chunks)) { - if (chunks[[chunk_spec]] > unlist(all_dims)[names(chunks)[chunk_spec]]) { + if (chunks[[chunk_spec]] > all_dims_merged[names(chunks)[chunk_spec]]) { stop("Too many chunks requested for the dimension ", names(chunks)[chunk_spec], - ". Maximum allowed is ", unlist(all_dims)[names(chunks)[chunk_spec]]) + ". Maximum allowed is ", all_dims_merged[names(chunks)[chunk_spec]]) } } default_chunks[names(chunks)] <- chunks diff --git a/R/Compute.R b/R/Compute.R index f08cb03bec26e6ce484e20e29384f9a88aafb640..5dd0c5cefff37c4242eb00747ac397c979a4e7be 100644 --- a/R/Compute.R +++ b/R/Compute.R @@ -39,8 +39,8 @@ Compute <- function(workflow, chunks = 'auto', paste(paste0('input', 1:length(workflow$inputs)), collapse = ", ")) if (length(workflow$params) > 0) { - op_text <- paste0(op_text, ", ") for (j in 1:length(workflow$params)) { + op_text <- paste0(op_text, ", ") op_text <- paste0(op_text, names(workflow$params)[j], " = ", paste(deparse(workflow$params[[j]]), collapse = '\n')) } diff --git a/R/Step.R b/R/Step.R index f215d9bac252802c40c5b4a9b458250059a28e93..d08595ab4adcb46105de7f381b31716b3bca8aa2 100644 --- a/R/Step.R +++ b/R/Step.R @@ -24,14 +24,14 @@ Step <- function(fun, target_dims, output_dims) { } # Check output_dims - if (is.character(output_dims)) { + if (is.character(output_dims) || is.null(output_dims)) { output_dims <- list(output_dims) names(output_dims) <- 'output1' } if (is.list(output_dims)) { sapply(output_dims, function(x) { - if (!(is.character(x) && (length(x) > 0))) { + if (!(is.character(x) || is.null(x))) { stop("Parameter 'output_dims' must be one or a list of vectors ", "of target dimension names for each data array input in ", "the function 'fun'.")