-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
questionFurther information is requestedFurther information is requested
Description
Would it be better to replace all the try statements with tryCatch, because we can assign return values like NA in case of error?
So, for example in boot_networklevel_once(), instead of having this:
for (i in 1:length(ids_lst)){
metric_lst[[i]] <- try({
web <- data[ids_lst[[i]], table(get(col_lower), get(col_higher))]
set.seed(42)
bipartite::networklevel(web = web, index = index, level = level, ...)
})
}we could better have this:
for (i in 1:length(ids_lst)){
metric_lst[[i]] <- tryCatch({
web <- data[ids_lst[[i]], table(get(col_lower), get(col_higher))]
set.seed(42)
bipartite::networklevel(web = web, index = index, level = level, ...)
},
error = function(e) NA)
}This will return NA-s in case of errors, though it might be dangerous because try can be still informative because it can return the error message ...
Though tryCatch can also be 'instructed' to pass the error message, but is just getting more verbose than try in that case.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested