3 ms·
> Functions like sapply vs mapply are tricky to reason about from the documentation alone. Could you please expand on that? It's unclear what you're referring
by nutshell42 3y ago
> Functions like sapply vs mapply are tricky to reason about from the documentation alone.
Could you please expand on that? It's unclear what you're referring to.
> The values NA vs Null vs integer(0) are all used as standins for real thrown errors and knowing which one to check for after calling a function can be tough.
`checkmate::assert_numeric()` (or similar)
with base R you want isTRUE():
`stopifnot(isTRUE(is.finite(x)))` (or is.na or anything else) will error on empty values.
- acc_297 3y agoI’ll check out those assert functions and I only meant that having apply,lapply,sapply,mapply took some getting used to most programming languages I had used prior include only 1 map / apply function and it’s still not clicking for me when there are performance penalties choosing one over another although I’ve read in the documentation that there are pros and cons