如何从 R 生成报告质量表? [英] How can I produce report quality tables from R?

查看:45
本文介绍了如何从 R 生成报告质量表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有以下名为 result 的数据框

If I have the following dataframe called result

> result
     Name       CV      LCB       UCB
1  within 2.768443 1.869964  5.303702
2 between 4.733483 2.123816 18.551051
3   total 5.483625 3.590745 18.772389

> dput(result,"")
structure(list(Name = structure(c("within", "between", "total"
), .rk.invalid.fields = list(), .Label = character(0)), CV = c(2.768443, 
4.733483, 5.483625), LCB = c(1.869964, 2.123816, 3.590745), UCB = c(5.303702, 
18.551051, 18.772389)), .Names = c("Name", "CV", "LCB", "UCB"
), row.names = c(NA, 3L), class = "data.frame")

很好地呈现这些数据的最佳方式是什么?理想情况下,我想要一个可以粘贴到报告中的图像文件,或者可能是一个 HTML 文件来表示表格?

What is the best way to present this data nicely? Ideally I'd like an image file that can be pasted into a report, or possibly an HTML file to represent the table?

设置有效数字的加分.

推荐答案

我会使用 xtable.我通常将它与 Sweave 一起使用.

I would use xtable. I usually use it with Sweave.

library(xtable)
d <- data.frame(letter=LETTERS, index=rnorm(52)) 
d.table <- xtable(d[1:5,])
print(d.table,type="html")

如果你想在 Sweave 文档中使用它,你可以像这样使用它:

If you want to use it in a Sweave document, you would use it like so:

<<label=tab1,echo=FALSE,results=tex>>=
xtable(d, caption = "Here is my caption", label = "tab:one",caption.placement = "top")
@

这篇关于如何从 R 生成报告质量表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆