Skip to content

Commit

Permalink
sapply => lapply
Browse files Browse the repository at this point in the history
  • Loading branch information
bblodfon committed Oct 6, 2023
1 parent 1fabbd7 commit 085e87a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions R/PredictionDataSurv.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ c.PredictionDataSurv = function(..., keep_duplicates = TRUE) {

if ("distr" %in% predict_types) {
distr_list = map(dots, "distr")
classes = sapply(distr_list, function(d) { class(d)[1] })
classes = lapply(distr_list, function(d) { class(d)[1] })
distr6_classes = c("Matdist", "VectorDistribution", "Arrdist")
data_classes = c("matrix", "array")

Expand All @@ -89,7 +89,7 @@ c.PredictionDataSurv = function(..., keep_duplicates = TRUE) {
# 2) in case of arrays, the size of the third dimension is also the same
# TODO(?): use code from distr6 to make matrices and arrays with same
# number of columns and fill in the survival probabilities inside
ncols = sapply(distr_list, ncol)
ncols = lapply(distr_list, ncol)
same_ncols = length(unique(ncols)) == 1

same_colnames = FALSE
Expand All @@ -99,7 +99,7 @@ c.PredictionDataSurv = function(..., keep_duplicates = TRUE) {
}
same_dim3 = TRUE # in case of matrices this is always true
if (classes[1] == "array") {
dim3_sizes = sapply(distr_list, function(x) dim(x)[[3L]])
dim3_sizes = lapply(distr_list, function(x) dim(x)[[3L]])
same_dim3 = length(unique(dim3_sizes)) == 1
}

Expand Down

0 comments on commit 085e87a

Please sign in to comment.