R View() does not display all columns of data frame

前端 未结 5 2001
梦毁少年i
梦毁少年i 2020-12-09 08:25

I have been adding columns to a data frame and using View() to check that it did what I expected. I have repeated lines of code along the lines of:



        
相关标签:
5条回答
  • 2020-12-09 08:31

    (Updated)

    You can have View() open in one of the quadrants or in a separate notepad-ish window. It opens in the quadrant where my source code is displayed on my machine at work, and in another window on my machine at home. In the latter case, it displays >1k rows & >100 columns (I just checked).

    I'm not sure how you can get this to change permanently, IIRC when I updated RStudio and ran View() the first time, a window popped up and asked me to choose what program I wanted to use to display the file. In one case I selected RStudio, and in the other case, I selected notepad. In both cases, the 'use this program by default from now on' radio button was selected; I have never seen this window since. If you can switch to displaying with notepad, you should be able to get out of this problem. However, short of a permanent change, you can get View() to display your data in a separate window using the code utils::View(). This approach works on my machine at work. Here is what it looks like:

    enter image description here

    Note that I am running RStudio version 0.97.248 on a Windows 7 machine.

    Here is what it looks like on my home machine where it comes up in a new window automatically:

    enter image description here

    0 讨论(0)
  • 2020-12-09 08:32

    I'm not sure if this has been mentioned before but I found this interesting post from 2012: https://support.rstudio.com/hc/en-us/community/posts/200669267-view-more-than-first-100-columns-.

    This indexing allows you to at least check the other columns and if they even exist.

    So just use: datafile[row-row, column-column].

    0 讨论(0)
  • 2020-12-09 08:33

    I just ran into this issue also. As suggested by gung above, the utils::View() function is helpful as a workaround for browsing all available columns in a data frame, whereas Rstudio still defaults to only the first 100 available columns when using the View() function.

    The workaround is very useful for identifying the column names for creating a subset from an existing data frame. However, it doesn't provide a quick column enumeration that the RStudio View() function allows. It's been a few years since the original post in 2013, but this limitation in the RStudio environment seems to still be effective in present-day 2017.

    0 讨论(0)
  • 2020-12-09 08:39

    I also see this problem with x <- matrix(1:200,nrow=1); View(x) in RStudio, but not in vanilla R. It is a known limitation and they're working on it. You can contact the devs on their forum to give your feedback (and have done so, I see).

    0 讨论(0)
  • 2020-12-09 08:43

    Try fix(). It loads all your columns and rows. The only problem is that it might take long to load large data frames.

    0 讨论(0)
提交回复
热议问题