Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Viewing more than 1000 rows in RStudio

In RStudio when you use the View() function, it only allows you to see up to 1000 rows. Is there any way to see more than that. I know it is possible to subset the viewing and see rows 1000-2000 for example, but I would want to be able to see 1-2000. The best I could find was a comment about a year ago saying that it wasn't possible at the time but they were planning on fixing this.

Here's an example (note: I'm guessing you will have to run this in RStudio).

rstudio <- (1:2000)
View(rstudio)
like image 658
Harrison Jones Avatar asked Aug 01 '13 19:08

Harrison Jones


People also ask

How many rows can RStudio handle?

As a rule of thumb: Data sets that contain up to one million records can easily processed with standard R. Data sets with about one million to one billion records can also be processed in R, but need some additional effort.

What is the maximum number of rows in R?

This is due to a 32-bit index used under the hood, and is true for 32-bit and 64-bit R. The number is 2^31 - 1. This is the maximum number of rows for a data.

How do I load more rows in R?

To add row to R Data Frame, append the list or vector representing the row, to the end of the data frame. nrow(df) returns the number of rows in data frame. nrow(df) + 1 means the next row after the end of data frame.

How do I view an entire dataset in R?

If you want to read the original article, click here View data frame in r: use of View() function in R. View data frame in r, within RStudio, the View() function in R can be used to call a spreadsheet-style data viewer. When using this function, make sure to use a capital “V”.


2 Answers

You can change this setting, for instance: options(max.print=5000)

like image 26
Sergio Lucero Avatar answered Sep 28 '22 18:09

Sergio Lucero


The View command is specifically for the little helper window. You can easily view the full value in the actual console window. If you want the same layout, use cbind.

cbind(rstudio)

which in fact will even give you the same nice row-numbering setup

And if that's too cumbersome

pview <- function(x, rows=100) { 
  if (length(x) > rows)
    print(cbind(x))
  else 
    print(cbind(head(x, rows/2)))
    print(cbind(tail(x, rows/2)))
 }
 pview(rstudio, 1998)

you will need to clean that up to get the row names to lineup

like image 196
Ricardo Saporta Avatar answered Sep 28 '22 19:09

Ricardo Saporta