Skip to content
Prev 333408 / 398506 Next

save table to txt file in a printable form

On Wed, 20 Nov 2013, Alaios <alaios at yahoo.com> writes:
Please provide an example that shows what you want to achieve, and why
capture.output does not work.

  A <- rnorm(12)
  dim(A) <- c(4,3)
  colnames(A) <- LETTERS[1:3]
  A

  #              A          B          C
  # [1,] 1.3883785  1.7264519 -0.1340838
  # [2,] 1.0601385 -0.2378076  0.2078081
  # [3,] 0.7278065 -0.1279776 -1.1674676
  # [4,] 1.3321629 -1.4082142  0.9145042

  capture.output(A)
  # [1] "             A          B          C"
  # [2] "[1,] 1.3883785  1.7264519 -0.1340838"
  # [3] "[2,] 1.0601385 -0.2378076  0.2078081"
  # [4] "[3,] 0.7278065 -0.1279776 -1.1674676"
  # [5] "[4,] 1.3321629 -1.4082142  0.9145042"

  # writeLines(capture.output(A), "matrix.txt") ## or similar
Please send plain-text emails.
Message-ID: <87wqk3ijxs.fsf@enricoschumann.net>
In-Reply-To: <1384932962.41154.YahooMailNeo@web125301.mail.ne1.yahoo.com> (alaios@yahoo.com's message of "Tue, 19 Nov 2013 23:36:02 -0800 (PST)")