Execute the book 1. Generate tikz figures and chapters.tex a. Open RStudio b. Files > Dropbox > Book > Chap02 c. Tools > Set Working Directory > To Source File Location d. Select lines 7 & 8 (require(tikzDevice); source()) and Run e. Sweave2("Chapter02.Rnw") f. Repeat a-e for Chapters 3-13 2. Compile PDF for Chapter01, AppendixA, AppendixB 3. latex Main.tex a. Comment all includeonly lines b. In Terminal window cd Dropbox/Book, type lualatex Main.tex (~ 20 minutes) c. Repeat lualatex at least 3 times Chapter 13: maps, ggplot2, oce, sp, quantreg Chapter 12: rjags: must install latest version of JAGS from Sourceforge, fields, BMA, sp rgdal: install from source, maps, maptools, colorRamps, spdep, coda, bootstrap, ggplot2 Chapter 11: maps, spatstat, sp, rgdal, maptools, cluster, xtable Chapter 10: gamlss, xtable, chron, reshape, ggplot2, network, sna, igraph Chapter 9: grid, gstat, maptools, sp, rgdal, maps, colorRamps, spdep, spgwr Chapter 8: quantreg, xtable, ismev, gamlss, gamlss.cens Chapter 7: pscl, xtable, plotmo, earth Chapter 6: lubridate, maps, ggplto2, survival, ncdf Chapter 5: lubridate, maps, classInt, maptools, rgdal, mapdata, ggplot2 Chapter 4: rjags, R2WinBUGS, lattice, LearnBayes Chapter 3: MASS, ellipse, xtable Chapter 2: UsingR Chapter 1: NONE This will generate the file listings. Will be examining ways to generate function listings from files. I suggest we use the output from Stangle as parsing may be tough. setwd("book") sourcefiles = dir(recursive=TRUE, pattern="*[.][rR]$") binarydatafiles = dir(recursive=TRUE, pattern="*[.][Rr][dD]ata$") textdatafiles = dir(recursive=TRUE, pattern="*[.]txt$") Stangle("Chap02/Chapter02.Rnw") rnw = dir(pattern="Chapter13.R") rnwdata = lapply(rnw, function(x) readLines(x)) require(stringr) funstrings = lapply(rnwdata, function(x) na.omit(str_extract("[0-9a-zA-Z_.]+[(].*[)]", string=x))) Pick through funstrings by hand and make a list. Save list by chapter. Chapter = numeric() Function = numeric() for(i in 2:13){ x = read.table(paste("chap",i,"funs.txt", sep="")) n = length(as.character(unique(x$V1))) Chapter = c(Chapter, rep(i, n)) Function = c(Function, as.character(unique(x$V1))) } x.df = data.frame(Chapter=Chapter, Function=Function) groups = split(x.df$Chapter, x.df$Function) str(groups, list.len=1000, vec.len=13) Copy/paste into text file then edit. Read the edited file and produce the LaTeX table in AppendixA.rnw. tbl = table(x.df) For function calls rnw = dir(recursive=TRUE, pattern="*[0-9][.][Rr]$") rnwdata = lapply(rnw, function(x) readLines(x)) require(stringr) funstrings = lapply(rnwdata, function(x) na.omit(str_extract("[0-9a-zA-Z_.]+[(].*[)]", string=x))) http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap09.html Hope this helps. We may need to fine tune the POSIX regular expression (extended) see ?regex require(spatstat) win = owin(xrange=c(0, 1), yrange=c(0, 1)) x = c(.5, .2, .7) y = c(.1, .4, .8) plot(win, main="") points(x, y, pch=19) spl = xspline(x, y, shape=-.5, draw=FALSE) points(spl, pch="+") n = length(spl$x) x0 = spl$x[1:(n-1)] y0 = spl$y[1:(n-1)] x1 = spl$x[2:n] y1 = spl$y[2:n] segs = psp(x0, y0, x1, y1, window=win) plot(segs, main="") pts = pointsOnLines(segs, eps=.05) plot(segs, main="") plot(pts, add=TRUE, pch="+") par(mfrow=c(1, 2)) plot(density.psp(segs)) plot(density.ppp(pts)) rpoisppOnLines(100*lengths.psp(segs), segs) plot(segs, main="") plot(pts, add=TRUE, pch="+") require(grid) hc = grid.circle(r=.05, x=.6, y=.2) grid.text("h", x=.6, y=.2) pic = grid.circle(r=.05, x=.4, y=.5) grid.text(expression(pi), x=.4, y=.5) nc = grid.circle(r=.05, x=.8, y=.5) grid.text("n", x=.8, y=.5) grid.curve(.43, .45, .55, .25, arrow=arrow(type="closed", length=unit(4, "mm")), angle=10, curvature=0, gp=gpar(fill="black")) grid.curve(.77, .45, .65, .25, arrow=arrow(type="closed", length=unit(4, "mm")), angle=10, curvature=0, gp=gpar(fill="black")) ac = grid.circle(r=.05, x=.2, y=.8) grid.text("a", x=.2, y=.8) bc = grid.circle(r=.05, x=.6, y=.8) grid.text("b", x=.6, y=.8) grid.curve(.23, .75, .35, .55, arrow=arrow(type="closed", length=unit(4, "mm")), angle=10, curvature=0, gp=gpar(fill="black")) grid.curve(.57, .75, .45, .55, arrow=arrow(type="closed", length=unit(4, "mm")), angle=10, curvature=0, gp=gpar(fill="black")) Reverses axis for plotting...good for Pressure axis x <- 0:10 set xlim and ylim set ylim to rev() the range() of 'x' plot(x, xlim = c(0, 10), ylim = rev(range(x))) Prevents the output from going beyond the margins str(ma, strict.width="cut") Covers grid lines in the legend box grid() legend("topleft", lty=1, lwd=2, col=cls, legend=lg, bg="white") If require is verbose, try switching to library with verbose=FALSE library(gamlss, verbose=FALSE) Or better <>= library(gamlss) \section{xspline} <>= plot(brd_lcc, col="gray") y = slot(dft, "coords")[, 2] x = slot(dft, "coords")[, 1] j = rep(1:k, each=3) for(i in 1:k){ res = xspline(x[j == i], y[j == i], shape=-0.5, open=TRUE, draw=FALSE) nr = length(res$x) lines(res, lwd=2, col="red") arrows(res$x[nr - 3], res$y[nr - 3], res$x[nr], res$y[nr], lwd=3, length=.07, code=2,col="red") } @ The returned tracks are listed by cyclone id. You flatten the track records by executing the rbind function using the \verb@do.call@ function. <>= tmp = do.call("rbind", t1$tracks) @