> >>>>>>>> >> >> Note that I don't really want to do rowSums in this case.  I'm just trying to >> demonstrate the error. >> >> Of course, it's clear that the first line does NOT contain five elements, nor >> does the second, etc., as all of the above-diagonal elements are blanks. >> >> But I've been unable to find an R input function that doesn't end up treating >> the source data as a table, i.e., in the context of Babel source blocks -- R >> is "happy" to read a lower-diagonal structure.  See the appendix for an >> example. >> >> Any suggestions?  Note that I'm happy to acknowledge that my own ignorance of >> R and/or Babel might be the source of the problem.  If so, please enlighten >> me. >> >> Thanks. >> >> -- Mike >> >> [1] http://www.jstatsoft.org/v46/i03 >> [2] https://github.com/eschulte/babel-presentation >> >> <<<<<< >> Appendix >> -------- >> >> >> $ cat pascal.dat >> 1 >> 1 1 >> 1 2 1 >> 1 3 3 1 >> 1 4 6 4 1 >> >> $ R --vanilla < pascal.R >> >> R version 2.15.0 (2012-03-30) >> Copyright (C) 2012 The R Foundation for Statistical Computing >> ISBN 3-900051-07-0 >> Platform: x86_64-redhat-linux-gnu (64-bit) >> . >> . >> . >> >>> x <- readLines("pascal.dat") >>> x >> [1] "1"         "1 1"       "1 2 1"     "1 3 3 1"   "1 4 6 4 1" >>> str(x) >>  chr [1:5] "1" "1 1" "1 2 1" "1 3 3 1" "1 4 6 4 1" >>> >>> y <- scan("pascal.dat") >> Read 15 items >>> y >>  [1] 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 >>> str(y) >>  num [1:15] 1 1 1 1 2 1 1 3 3 1 ... >>> >>> z <- read.table("pascal.dat", header=FALSE) >> Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  : >>   line 1 did not have 5 elements >> Calls: read.table -> scan >> Execution halted >> >> -- Eric Schulte http://cs.unm.edu/~eschulte/