Skip to content

save table to txt file in a printable form

2 messages · Alaios, Enrico Schumann

#
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.