Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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,
               encoding = "native", 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.

encoding

to be used in the main readLines(file, encoding=encoding) call.

fileEncoding

if file is a file name, i.e., a character string, and fileEncoding is not the empty string, file(file, "rt", encoding = fileEncoding) will be used.

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 read.table on file (but on a textConnection).

Value

Note

TODO: It should be easy to extend read.org.table() to also work for some of the proposed Markdown formats for tables. Please write to maintainer("sfsmisc") or open a github issue if you are interested.

References

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

See Also

CRAN package ascii can write org tables. read.table

Examples

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))

sfsmisc

Utilities from 'Seminar fuer Statistik' ETH Zurich

v1.1-11
GPL (>= 2)
Authors
Martin Maechler [aut, cre] (<https://orcid.org/0000-0002-8685-9910>), Werner Stahel [ctb] (Functions: compresid2way(), f.robftest(), last(), p.scales(), p.dnorm()), Andreas Ruckstuhl [ctb] (Functions: p.arrows(), p.profileTraces(), p.res.2x()), Christian Keller [ctb] (Functions: histBxp(), p.tachoPlot()), Kjetil Halvorsen [ctb] (Functions: KSd(), ecdf.ksCI()), Alain Hauser [ctb] (Functions: cairoSwd(), is.whole(), toLatex.numeric()*), Christoph Buser [ctb] (to function Duplicated()), Lorenz Gygax [ctb] (to function p.res.2fact()), Bill Venables [ctb] (Functions: empty.dimnames(), primes()), Tony Plate [ctb] (to inv.seq()), Isabelle Fl<fc>ckiger [ctb], Marcel Wolbers [ctb], Markus Keller [ctb], Sandrine Dudoit [ctb], Jane Fridlyand [ctb], Greg Snow [ctb] (to loessDemo()), Henrik Aa. Nielsen [ctb] (to loessDemo()), Vincent Carey [ctb], Ben Bolker [ctb], Philippe Grosjean [ctb], Fr<e9>d<e9>ric Ibanez [ctb], Caterina Savi [ctb], Charles Geyer [ctb], Jens Oehlschl<e4>gel [ctb]
Initial release
2021-04-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.