# Create a file namefilen <- "table_aov" # or# filen <- paste("YOUR_DIR/table_aov")# Generate ANOVA outputfit=aov(yield ~ block + N * P + K, data = https://www.520longzhigu.com/shenghuo/npk) #'npk' dataset from base 'datasets'x=summary(fit)# Save ANOVA table as a CSV### Option 1: pass output as object# 输出对象table2csv(x=x,file=filen, digits = 1, digitspvals = 3, add.rownames=TRUE)# 屏幕输出导出到文件### Option 2: get output from consolesummary(fit)table2csv(file=filen, digits = 2, digitspvals = 4, add.rownames=TRUE)# Save ANOVA table as an Excel# Without formatting of the worksheetxtable2excel(file=filen, sheetName="aov_noformatting", digits = 1, digitspvals = 3, add.rownames=TRUE)# 更多参数# With formatting of the worksheettable2excel(x=x,file=filen, sheetName="aov_formated", append = TRUE, add.rownames=TRUE, fontName="Arial", fontSize = 14, fontColour = rgb(0.15,0.3,0.75), border=c("top", "bottom"), fgFill = rgb(0.9,0.9,0.9), halign = "center", valign = "center", textDecoration="italic")
原始数据的表格:
转换格式之后的,在console中的数据:
文件(csv和excel)中表格数据:
导出为Word中的表,再也不用复制粘贴调格式了 table2officetable2ppt: 导出统计输出到Microsoft Office PowerPoint/ LibreOffice Impress演示文稿中的表
table2doc: 将统计输出导出到Microsoft Office Word/ LibreOffice Writer文档中的表
table2office(x = NULL, file = "Rtable", type = c("PPT", "DOC"),append = FALSE, digits = 2, digitspvals = 2, trim.pval = TRUE,width = NULL, height = NULL, offx = 1, offy = 1,font = ifelse(Sys.info()["sysname"] == "Windows", "Arial","Helvetica")[[1]], pointsize = 12, add.rownames = FALSE)
# Create a file namefilen <- "table_aov"# filen <- paste("YOUR_DIR/table_aov")# Generate ANOVA outputfit=aov(yield ~ block + N * P + K, data = https://www.520longzhigu.com/shenghuo/npk) #'npk' dataset from base 'datasets'# Save ANOVA table as a PPT### Option 1: pass output as objectx=summary(fit)table2ppt(x=x,file=filen, digits = 1, digitspvals = 3, add.rownames =TRUE)### Option 2: get output from consolesummary(fit)table2ppt(x=x,file=filen, width=5, font="Times New Roman", pointsize=14, digits=4, digitspvals=1, append=TRUE, add.rownames =TRUE) # append table to previous slide# Save ANOVA table as a DOC filetable2doc(x=x,file=filen, digits = 1, digitspvals = 3, add.rownames =TRUE)summary(fit)table2doc(file=filen, width=3.5, font="Times New Roman", pointsize=14, digits=4, digitspvals=1, append=TRUE, add.rownames =TRUE) # append table at end of document
将表格数据导出到ppt和word中:
table2textable2html: 导出统计输出到HTML表 。
table2tex(x = NULL, file = "Rtable", type = "TEX", digits = 2,digitspvals = 2, trim.pval = TRUE, summary = FALSE, standAlone = TRUE,add.rownames = FALSE, ...)
summary:是否汇总数据文件 。
standAlone:导出的Latex代码应该是独立可编译的,还是应该粘贴到另一个文档中 。
add.rownames:是否应该将行名添加到表中(在第一列之前插入一列) 。
# Create a file namefilen <- tempfile(pattern = "table_aov") # or# filen <- paste("YOUR_DIR/table_aov")# Generate ANOVA outputfit=aov(yield ~ block + N * P + K, data = https://www.520longzhigu.com/shenghuo/npk) #'npk' dataset from base 'datasets'x=summary(fit)# Export to Latex in standAlone formattable2tex(x=x,file=filen,add.rownames = TRUE)# Export to Latex to paste in tex documentsummary(fit) # get output from the consoletable2tex(file=filen, standAlone = FALSE,add.rownames = TRUE)# Export to HTMLtable2html(x=x,file=filen) # orsummary(fit) # get output from the consoletable2html(file=filen,add.rownames = TRUE)
导出到html或tex中的表格数据:
R统计和作图
- Graphpad,经典绘图工具初学初探
- 维恩(Venn)图绘制工具大全 (在线+R包)
- 在R中赞扬下努力工作的你,奖励一份CheatShet
以上关于本文的内容,仅作参考!温馨提示:如遇健康、疾病相关的问题,请您及时就医或请专业人士给予相关指导!
「四川龙网」www.sichuanlong.com小编还为您精选了以下内容,希望对您有所帮助:- PDF转换成Excel的方法 PDF如何转换成EXCEL
- 南方立秋吃什么 立秋养生吃什么好
- 如何防蚊虫叮咬 夏天防蚊虫的方法
- 秋冬季如何养生 秋冬季健康养生方法
- 夏季如何养生 夏季养生饮食小常识
- 冬季御寒措施 冬季如何保暖御寒
- 天冷吃什么食物好 什么茶适合天冷喝
- 图文 属鼠都是怎么看待抑郁症患者的
- 图文 关灯后 属鼠女生最喜欢跟男友聊什么
- 图文 最让属鼠在生活中感觉到骄傲的时候