简体   繁体   English

在R中将表格打印到新窗口

[英]Print a table to new window in R

In R, plot() opens a new window within R and displays a graph. 在R中,plot()在R中打开一个新窗口并显示图形。

Is there a way to do the same thing with a table - without printing to the command line? 有没有办法用表格做同样的事情-不用打印到命令行?

I don't mean print(), or head(), or sink() to a file. 我不是说print(),head()或sink()到文件。

This would be useful as one could transfer tables to a separate window without messing up the console. 这将很有用,因为可以将表转移到单独的窗口而不会弄乱控制台。

vprint <- function(x, ...) {
  require(htmltools)
  html_print(pre(paste0(capture.output(print(x, ...)), collapse="\n")))
}

vcat <- function(...) {
  require(htmltools)
  html_print(pre(paste0(capture.output(cat(...)), collapse="\n")))
}

vprint(mtcars)

vcat(str(mtcars))

Possible solutions: 可能的解决方案:

view, fix, page, edit 查看,修复,页面,编辑

View: Just viewing data frame or matrix 查看:仅查看数据框或矩阵
fix: You can edit data (but you can not undo it!) 修复:您可以编辑数据(但不能撤消它!)
page: It is like linux less command 页面:就像linux less命令
edit: it is like fix! 编辑:就像修复!
data.entry: it is like fix! data.entry:就像修复!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM