The dataframe viewer in Rstudio can be slow or unresponsive, and at times truncates the content within or the number of columns on large datasets. I want to be able to see the full columns and to be able to arrange and filter simultaneously. Although you can do this in R programmatically sometimes its easier and quicker to use Excel. The function below can be used to open a dataframe in Microsoft Excel.

This may be worth sticking in your .RProfile so it is always available.

excel <- function(df) {
  f <- paste0(tempdir(),
              '/',
              make.names(deparse(substitute(df))),
              '.',
              paste0(sample(letters)[1:5],collapse=""),
              '.csv')
  write.csv(df,f)
  system(sprintf("open -a 'Microsoft Excel' %s",f))
}

To use, just type:

excel(dataframe)

# Or pipe in using dplyr

df %>% excel()

Microsoft Excel will open with the dataframe that has been passed.