turn off 'tibble' as default for imports?

So, running 2022.07.1 - build 554. Was following along with some online 'RStudio tutorials' (which I'm hoping to use for one of my classes), when all of a sudden, various 'steps of the tutorial' no longer worked. Took me a while to figure out that imported Excel files are no longer 'standard' dataframes - they're now tibbles.

PITA -- sure, I can convert from a tibble -> dataframe, but, is there an option that would let the RStudio user simply turn off the new default behaviour - when using GUI imports for Excel files? Seriously - I'm not a fan of tidyverse, or tibbles as part of same.

1 Like

I always thought a tibble is just another (an improved) presentation of a dataframe, thinking that everything that can be done on a dataframe can also be done on a tibble.
Now I am curious: What isn't working with a tibble that works with a dataframe?

Regarding your question: Not sure, but maybe you can swap to the non-tidyverse related importers, as openxlsx instead of readxl, read.csv instead read_csv...

Lots of subsetting functions that work with dataframes don't work (or, work differently) with tibbles.

And yes, I can use other tools to import .xlxs files into R from the CLI, that don't 'mess' with things by turning them into tibbles. But....in the teaching environment, I'll no longer be able to simply have student use the GUI feature in RStudio to import from Excel -> dataframe, because....it no longer does. It imports into a tibble.

If you are teaching I would suggest not to use the GUI at all for actions such as importing.

Use code instead and this will help students who continue using R beyond your classes. This will also allow the use of packages to be understood.

Agreed, except that most non-CS students look for a 'menu option' to do basic things -- and the 'import Excel' option in RStudio is very 'tempting'. So now the lecture has to cover silly things like 'well, you could import that way, but then you'd need to convert'.

Basically, my teaching defaults are: (1) always put an Excel file in .csv first, and (2) ignore/don't use/ban tidyverse.

Using read.csv() or whatever does not require CS.

The rest of the analysis (data analysis, statistical tests, plots, etc.) will presumably be based on typing in code, so I don't see what difference an extra line at the start makes.

If coding is to be avoided and everything done via a GUI then R should not be used at all.

2 Likes

Sure, but my original question still stands -- RStudio would be 'improved' if there was a preference that allowed the user to specify what package(s) is used for importing data. The fact that it hard-defaults to tibble is Draconian. IMO, defaults should always be base R. Period.

2 Likes

The forum to request features in RStudio IDE can be found here :

I agree with you on that.

I've got an older version of RStudio installed, so cannot check what it's like now, but in mine there is a choice between base and readr for text import and it seems to use readxl for Excel (not csv) files.

If they are forcing people down the tidyverse route by removing the base option then that is really regrettable.

1 Like

Thanks! I'll do that. I'm fairly sure that it might be a (i) popular, and (ii) easy to implement option.

Current version still allows base and readr for text import. The issue is with Excel files, and direct import for Excel files. Hence, my admonition to students that they export from Excel -> csv as a first step.

Ok, I see your point. I thought readxl always would have imported a dataset as a tibble, but I may be wrong.

I guess the GUI could check for common packages for importing Excel files (openxlsx, etc.) and allow the user to select one.

1 Like

You can use import(path to your excel file including the Excel extension) from the rio package. This package it’s great for teaching, because with its import () function you can import all commonly used file formats. Rio returns by default a data frame.

1 Like

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.