在R中将数据帧导出为pdf/png

在R中将数据帧导出为pdf/png,r,dataframe,R,Dataframe,以下是我的示例数据集: Singer <- c("A","B","C","A","B","C") Rank <- c(1,2,3,3,2,1) Episode <- c(1,1,1,2,2,2) Votes <- c(0.3,0.28,0.11,0.14,0.29,0.38) Result <- data_frame(Episode,Singer,Rank,Votes) Singer如果要导出为png,可以执行以下操作: library(gridExtra) p

以下是我的示例数据集:

Singer <- c("A","B","C","A","B","C")
Rank <- c(1,2,3,3,2,1)
Episode <- c(1,1,1,2,2,2)
Votes <- c(0.3,0.28,0.11,0.14,0.29,0.38)

Result <- data_frame(Episode,Singer,Rank,Votes)

Singer如果要导出为png,可以执行以下操作:

library(gridExtra)
png("test.png", height = 50*nrow(df), width = 200*ncol(df))
grid.table(df)
dev.off()
library(gridExtra)
pdf("test.pdf", height=11, width=10)
grid.table(df)
dev.off()

如果要导出为pdf格式,可以执行以下操作:

library(gridExtra)
png("test.png", height = 50*nrow(df), width = 200*ncol(df))
grid.table(df)
dev.off()
library(gridExtra)
pdf("test.pdf", height=11, width=10)
grid.table(df)
dev.off()

比什么容易?你没有告诉我们你做了什么。你可以检查我在哪个路径可以找到这个pdf?