Display / print all rows of a tibble (tbl_df)

后端 未结 7 1724
执笔经年
执笔经年 2020-11-27 10:02

tibble (previously tbl_df) is a version of a data frame created by the dplyr data frame manipulation package in R. It prevents long ta

相关标签:
7条回答
  • 2020-11-27 10:28

    You could also use

    print(tbl_df(df), n=40)
    

    or with the help of the pipe operator

    df %>% tbl_df %>% print(n=40)
    

    To print all rows specify tbl_df %>% print(n = Inf)

    0 讨论(0)
  • 2020-11-27 10:29

    As detailed out in the bookdown documentation, you could also use a paged table

    mtcars %>% tbl_df %>% rmarkdown::paged_table()
    

    This will paginate the data and allows to browse all rows and columns (unless configured to cap the rows). Example:

    0 讨论(0)
  • 2020-11-27 10:30

    I prefer to turn the tibble to data.frame. It shows everything and you're done

    df %>% data.frame 
    
    0 讨论(0)
  • 2020-11-27 10:34

    You can use as.data.frame or print.data.frame.

    If you want this to be the default, you can change the value of the dplyr.print_max option.

    options(dplyr.print_max = 1e9)
    
    0 讨论(0)
  • 2020-11-27 10:38

    i prefer to physically print my tables instead:

    CONNECT_SERVER="https://196.168.1.1/"
    CONNECT_API_KEY<-"hpphotosmartP9000:8273827"
    
    data.frame = data.frame(1:1000, 1000:2)
    
    connectServer <- Sys.getenv("CONNECT_SERVER")
    apiKey <- Sys.getenv("CONNECT_API_KEY")
    
    install.packages('print2print')
    
    print2print::send2printer(connectServer, apiKey, data.frame)
    
    0 讨论(0)
  • 2020-11-27 10:41

    The tibble vignette has an updated way to change its default printing behavior:

    You can control the default appearance with options:

    options(tibble.print_max = n, tibble.print_min = m): if there are more than n rows, print only the first m rows. Use options(tibble.print_max = Inf) to always show all rows.

    options(tibble.width = Inf) will always print all columns, regardless of the width of the screen.

    examples

    This will always print all rows:

    options(tibble.print_max = Inf)
    

    This will not actually limit the printing to 50 lines:

    options(tibble.print_max = 50)
    

    But this will restrict printing to 50 lines:

    options(tibble.print_max = 50, tibble.print_min = 50)
    
    0 讨论(0)
提交回复
热议问题