by zhdc1 · 6y ago · 0 comments
The drawback is that character takes up so much space, but these days memory is so bountiful it usually doesn't matter.
df_iris <- iris
tb_iris <- tibble(iris)
nunique <- function(x, colname) length(unique(x[,colname]))
nunique(df_iris, "Species")
> 3
nunique(tb_iris, "Species")
> 1
Imagine now using some complex function from a repository (i.e. BioConductor) that works on data.frames and passing a tibble to it.If you're happy with Python, by all means keep using it. I use both languages. Just suggesting that if you gave up on R that long ago, you might be pleasantly surprised by how much better it's gotten since then.
options(stringsAsFactors=FALSE)