Learn R Programming

sfsmisc (version 1.0-2)

read.org.table: Read.table for an Emacs Org Table

Description

Read an emacs Org table (in file or text) by read.table().

Usage

read.org.table(file, header = TRUE, skip = 0, fileEncoding = "", text, ...)

Arguments

file
a file name, a file or other connection.
header
logical indicating if the org table has header line (in the usual "|"-separated org table format).
skip
integer number of initial lines to skip.
fileEncoding
text
instead of file, a character or string (of a few lines, typically).
...
further arguments passed to read.table. You should not use encoding (but possibly fileEncoding!) here, as we do not call

Value

References

Org-Mode Manual on Tables, http://orgmode.org/manual/Tables.html

Org tutorial for tables, http://orgmode.org/manual/Tables.html

See Also

CRAN package ascii can write org tables. read.table

Examples

Run this code
t1 <-
"| a | var2 |   C |
|---+------+-----|
| 2 | may  | 3.4 |
| 7 | feb  | 4.7 |
"
d <- read.org.table(text = t1)
d
stopifnot(dim(d) == c(2, 3),
          identical(names(d), c("a", "var2", "C")),
          d[,"a"] == c(2,7))

Run the code above in your browser using DataLab