Delete comment from: One R Tip A Day
and... yet another suggestion on "tidying up" R code:
> library(animation)
# copy the code to clipboard now, and
> tidy.source()
png("immigration_bubbleplot_me.png", width = 1400,
height = 400)
par(mar = c(3, 6, 3, 2))
mag = 0.9
original.vec <- as.matrix(original)
dim(original.vec) <- NULL
symbols(rep(1:dim(original)[[1]], dim(original)[[2]]),
rep(5:1, each = dim(original)[[1]]), circles = original.vec,
inches = mag, fg = "grey85", bg = "grey20", axes = F, ylab = "",
xlab = "", xlim = range(1:dim(original)[[1]]), ylim = c(1,
6), main = "Immigration to the USA - 1821 to 2006")
axis(1, 1:dim(original)[[1]], labels = rownames(original),
las = 1, col = "grey85", tck = 1)
axis(2, 1:dim(original)[[2]], labels = rev(colnames(original)),
las = 1, col = "grey85", tck = 1)
box(col = "grey85")
symbols(rep(1:19, dim(original)[[2]]), rep(5:1, each = dim(original)[[1]]),
circles = original.vec, main = "", inches = mag, fg = "grey85",
bg = "grey20", axes = F, ylab = "", xlab = "", add = T, xlim = range(1:dim(original)[[1]]),
ylim = c(1, 6))
dev.off()
# but a big disadvantage is you cannot keep the comments when using tidy.source()! :-(
# any ideas on "reformatting R code"?
Jan 6, 2009, 11:59:00 PM
Posted to Statistical Visualizations - Part 2

