After reading the convincing book R for Data Science I was excited about all the tidyverse functions, especially the transformation and data wrangling components dplyr and tidyr. It seemed that coding with those saves a lot of time and results in better readability compared to base R. But the more I use dplyr, the more I encounter situations where the opposite seems to be the case. In one of my last questions I asked how to replace rows with NAs if one of the variable exceeds some threshold. In base I would simply do
df[df$age > 90, ] <- NA
The two answers suggested using
df %>% select(x, y, age) %>% mutate_all(~replace(.x, age> 90, NA))
# or
df %>% mutate_all(function(i) replace(i, .$age> 90, NA))
Both answers are great and I am thankful to get them. Still, the code in base R seems so much simpler to me. Now I am facing another situation where my code with dplyr is much more complicated, too. I am aware that it is a subjective impression whether some code is complicated, but putting it in a more objective way I would say that nchar(dplyr_code) > nchar(base_code) in many situations.
Further, I noticed that I seem to encounter this more often if the code I need to write is about operations on rows rather than on columns. It can be argued that one can use tidyr from tidyverse to transpose the data in order to change rows to columns. But even doing this seems also much more complicated in the tidyverse frame than in base R (see here).
My question is whether I am facing this problem because I am quite new to tidyverse or whether it is the case that coding with base is more efficient in some situations. If latter is the case: Are there resources that summarize on a abstract level when it is more efficient to code with base versus tidyverse or can you state some situations? I am asking because sometimes I spend quite some time to figure out how to solve something with tidyverse and in the end I notice that base is a much more convenient coding in this situation. Knowing when to use tidyverse or base for data wrangling and transformation would save me much time.
If this question is too broad, please let me know and I will try to rephrase or delete the question.