2015-04-01 107 views
1

dplyr::as.tbl(mtcars)僅填充10行的屏幕上,如在下面的截圖:dplyr :: tbl_df填滿整個屏幕

enter image description here

能否R上配置爲使得如果一個tbl_df能夠填滿整個ř窗口而沒有任何數據'從窗口掉下來'(如mtcars的情況),則dplyr將強制tbl_df填充整個窗口。

所以我想的dplyr::as.tbl(mtcars)輸出爲:

enter image description here

+0

據http://blog.rstudio.org/2015/ 01/09/dplyr-0-4-0 /'options(dplyr.print_max)現在是20,所以dplyr永遠不會打印超過20行的數據(以前它是100)。查看更多行數據的最好方法是使用View()。' – akrun 2015-04-01 16:34:34

+1

您可以嘗試'options(dplyr.print_max = 1e4)' – akrun 2015-04-01 16:37:17

+1

同時檢查http://stackoverflow.com/questions/23188900/view-entire- dataframe-when-wrapped-in-tbl-df – akrun 2015-04-01 17:03:04

回答

8

幾種方法來實現:

# show up to 1000 rows and all columns *CAPITAL V in View* 
df %>% View() 

# set option to see all columns and fewer rows 
options(dplyr.width = Inf, dplyr.print_min = 6) 

# reset options to defaults (or just close R) 
options(dplyr.width = NULL, dplyr.print_min = 10) 

# for good measure, don't forget about glimpse()... 
df %>% glimpse() 
+0

我想知道......任何人都可以提供一個函數,如果整個'tbl_df'對象將填充整個R窗口,將會打印整個'tbl_df'對象? – luciano 2015-04-01 17:25:26