Skip to content

Commit

Permalink
Fix for "Error in lank$category_list"
Browse files Browse the repository at this point in the history
Test for existence of class_list and return appropriate values. Fix for
issue sachsmc#12.
  • Loading branch information
titaniumtroop committed Sep 20, 2017
1 parent 4ad4f4f commit 1c9019d
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions R/gather_results.R
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,14 @@ gather_results <- function(parsed){
}
})

names(lank)[names(lank) == "class_list"] <- "category_list"
target <- lank$category_list
fillout <- lank[names(lank) != "category_list"]
cbind(fillout, target)
if (any(names(lank) == "class_list", na.rm = T)) {
names(lank)[names(lank) == "class_list"] <- "category_list"
target <- lank$category_list
fillout <- lank[names(lank) != "category_list"]
cbind(fillout, target)
} else {
data.frame(lank)
}

}))

Expand Down Expand Up @@ -177,9 +181,13 @@ gather_results <- function(parsed){
}
})

target <- lank$category_list
fillout <- lank[names(lank) != "category_list"]
cbind(fillout, target)
if (is.recursive(lank)) {
target <- lank$category_list
fillout <- lank[names(lank) != "category_list"]
cbind(fillout, target)
} else {
data.frame(lank)
}

}))

Expand Down

0 comments on commit 1c9019d

Please sign in to comment.