mpjashby/crimemapping

Add box with 10 R functions never to use

Opened this issue · 4 comments

For example, base::attach().

In each case, explain why students shouldn't use it.

This should probably go in the tutorial on handling errors, since the reason the functions should not be used will typically because they make code (or coders) more prone to errors.

utils::read.csv(), since it's always better to use readr::read_csv() due to the result being easier to work with.

base::ifelse() because it sometimes silently changes the types of objects or strips attributes – use dplyr::if_else() instead.

There aren't enough of these yet to make a new section worthwhile, so I'll hold this over for next year.

base::as.data.frame() because it's always better to use a tibble, and because some students use this function when data is already in a df/tbl format (I don't know why).