With the release of R 4.0.0 upon us, let’s take a moment to understand a few parts of the release that are worth knowing about.
This is a new utility that will convert your lists to a data frame. It’s very friendly, in the sense that it attempts to avoid errors by making assumptions on how to fill in gaps. That could lead to heartache when those don’t align with what you’re expecting, so be careful!
> one <- list(1:3, letters[5:10], rep(10,7)) > list2DF(one) 1 1 e 10 2 2 f 10 3 3 g 10 4 1 h 10 5 2 i 10 6 3 j 10 7 1 e 10
sort.list for non-atomic objects
Vectors and matrices are the most common non-atomic objects in R. The function sort.list now works with these. Previously you could use order on either of these, but if you’ve chosen to employ sort.list within your functions, you won’t have to error handle the outcomes of non-atomic objects.
> mtx.test <- matrix(1:9, nrow = 3, byrow = TRUE) > sort.list(mtx.test)  1 4 7 2 5 8 3 6 9
New Color Palettes!
You can check out the new palettes using the palette.pals function. R has always been strong in visualizations, and while Detroit Data Lab won’t endorse Tableau color schemes, we’re excited to see the better accessibility offered by some color palettes. See the new R4 palette below using a simple code snippet.
> palette("R4") > palette()  "black" "#DF536B" "#61D04F" "#2297E6" "#28E2E5" "#CD0BBC" "#F5C710" "gray62" > show_col(palette())
stringsAsFactors = FALSE
You knew it was coming, and this list wouldn’t be complete without it. By default, stringsAsFactors is now set to FALSE. Many programmers have explicitly stated this out of habit, but it’s worth checking your code bases to ensure you know what you’re reading and how you’re handling it.