No tibble after using tidyverse functions

My students are learning tidyverse (dplyr) functions, and they used a script I shared with them in RStudio Cloud (working in their own copy).

For one of my students something peculiar is going on: after using tidyverse functions, the results are still data frames. Using

as_tibble()

also gets completely ignored, still returning a data frame.

All relevant libraries are loaded, and tidyverse functions work as expected for the rest. This is code they got from me, and it worked/works fine in my original project.
I'm stumped on how this can happen?

I think it would help if you would create a reproducible example (reprex) where you

  • Create a tibble
  • Show the tibble/data.frame
  • Show the result of the str function applied on the tibble/data.frame

Updated:

  • Show the contents of the as.tibble function.

Ah - as I was double checking the student's code, I realized they had changed read_csv() to read.csv(). Then when they applied filter, select and arrange the data frame stayed a data frame of course!

Nice, easy typo to make.
Just as I did by typing as.tibble instead of as_tibble . :cry:

Maybe the IDE should let you set a "prefer tibble" flag, and warn about non-tibble functions?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.