Skip to content

Commit

Permalink
check if the list entry is of length 1, otherwise can unlist it in 2.15
Browse files Browse the repository at this point in the history
  • Loading branch information
spennihana committed Jun 27, 2014
1 parent a0dfd1f commit 616dc08
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions R/h2o-package/R/Internal.R
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,12 @@ function(expr) {
function(some_expr_list) {
len <- length(some_expr_list)
while(len > 1) {
num_sub_lists <- length(unlist(some_expr_list[[len]])) / length(some_expr_list[[len]])
num_sub_lists <- 0
if (length(some_expr_list[[len]]) == 1) {
num_sub_lists <- 1
} else {
num_sub_lists <- length(unlist(some_expr_list[[len]])) / length(some_expr_list[[len]])
}
if (num_sub_lists > 1) {
some_expr_list[[len]] <- .back_to_expr(some_expr_list[[len]])
} else if (is.atomic(some_expr_list[[len]]) || is.name(some_expr_list[[len]])) {
Expand Down Expand Up @@ -511,7 +516,12 @@ function(some_expr_list, envir) {
while(i <= len) {

# Check if there are sub lists and recurse them
num_sub_lists <- length(unlist(some_expr_list[[i]])) / length(some_expr_list[[i]])
num_sub_lists <- 0
if (length(some_expr_list[[i]]) == 1) {
num_sub_lists <- 1
} else {
num_sub_lists <- length(unlist(some_expr_list[[i]])) / length(some_expr_list[[i]])
}
if (num_sub_lists > 1) {

# recurse on the sublist
Expand Down

0 comments on commit 616dc08

Please sign in to comment.