BarPieImage
Example List of Images

Description

The data.frame BarPieImage contains three images of plots created in Open Source R. Each image shows a barchart and a piechart of the same data.
The data.frame BarPieData contains data displayed in the images in BarPieImage.

Usage

data(BarPieImage)
data(BarPieData)
Format
BarPieImage is a data.frame with 3 observations with the following variable
BarVsPie
a raw object of a PNG image created in Open Source R.
BarPieData is a data.frame with containing the data used to created the plots in BarPieImage. It contains the following variables
Chart
an integer denoting which image the data is used in.
Group
the letters A-E denoting which group each Value belongs to.
Value
a numeric value for the plot.

Details

The code in the example shows how BarPieImage was created from BarPieData.
Examples
## Not run: 
# This code needs to be run in Open Source R to create the PNG images.
BarPieData <- read.csv("BarPieData.csv")
save(BarPieData, file="BarPieData.rda")
#
png(filename="bar_vs_pie_chart_%01d.png", width=350, height=300)
par(mfrow=c(1,2))
par(mar=c(2.1, 2.1, 3, 0))
#
nchart <- length(unique(BarPieData$Chart))
for(i in seq.int(nchart)) {
  datasub <- with(BarPieData, BarPieData[Chart == i, ])
  barplot(datasub$Value, names=datasub$Group, col=2:6,
    main=paste("Bar Plot", i))
  pie(datasub$Value, labels = datasub$Group, col=2:6,
    main=paste("Pie Chart", i))
}
#
dev.off()
#
BarPieImage <- data.frame(BarVsPie = seq.int(nchart), stringsAsFactors = FALSE)
glist <- list()
for(i in seq.int(nchart)) {
  pngFile <- paste0("bar_vs_pie_chart_", i, ".png")
  glist[[i]] <- readBin(pngFile, what="raw", n=file.info(pngFile)$size)
}
names(glist) <- paste0("Chart_", seq.int(nchart))
BarPieImage[["BarVsPie"]] <- glist
save(BarPieImage, file="BarPieImage.rda")

## End(Not run)
Package SpotfireData version 6.1.2-7
Package Index