在 R-markdown 中显示 tibble 的所有行和列

问题描述:

我正在处理 R 降价文件.分析结果以tibble的形式显示,但为了看到所有的列和行,我需要点击展开.但是,由于我要将文件编织成 html,因此我需要显示 R markdown 文件中的所有列和行.我进行了搜索并得出了以下代码:

I'm working on an R markdown file. The results of analysis are shown in the form of tibble but in order to see all the columns and rows, I need to click to expand. However, since I'm going to knit the file into html, I need to display all the columns and rows in the R markdown file. I did a search and came up with the following codes:

options(tibble.width = Inf) # displays all columns.
options(tibble.print_max = Inf) # to show all the rows.

但是,我不知道把它们放在哪里.我把它们放在我的代码之前和之后,但没有用.我的代码是:

However, I don't know where to put them. I placed them before and after my code, but it didn't work. MY codes are:

  1. head(df)
  2. summarise(mean_cov= ...,median_cov=...., sd_cov=...., ...)

谢谢.

a tibble 是一种特定类型的 data.frame(尝试 class(df)),并且它有自己的打印方法,当你想要完整的东西时会很沮丧.

a tibble is a specific type of data.frame (try class(df)), and it has its own method to print, which is frustrating when you want the full thing.

因为它仍然是一个 data.frame 虽然你可以使用 data.frames 的方法并且它会打印所有内容,请尝试:

As it's still a data.frame though you can use the method for data.frames and it will print everything, try:

print.data.frame(df)

print.data.frame(head(df))

print.data.frame(summarize...)

注意 as.data.frame 将有相同的输出

Note that as.data.frame will have the same output