我有一个表,我想使用 tableGrob 将其与 ggplot2 绘图一起绘制。出于输出目的,我想禁止打印 NA 。
例子:
library(RGraphics) # support of the "R graphics" book, on CRAN
library(gridExtra)
tab <- head(iris)
tab[1,2] <- NA # set a couple values to NA for example purposes
g1 <- tableGrob(tab)
#"Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width" "Species"
g2 <- qplot(Sepal.Length, Petal.Length, data=iris, colour=Species)
grid.arrange(g1, g2, ncol=1, main="The iris data")