Description Usage Arguments Value See Also Examples
View source: R/docx-extract-tbl.r
Given a document read with read_docx
and a table to extract (optionally
indicating whether there was a header or not and if cell whitepace trimming is
desired) extract the contents of the table to a data.frame
.
1 2 3 4 5 6 7 | docx_extract_tbl(
docx,
tbl_number = 1,
header = TRUE,
preserve = FALSE,
trim = TRUE
)
|
docx |
|
tbl_number |
which table to extract (defaults to |
header |
assume first row of table is a header row? (default; |
preserve |
preserve line breaks within a cell? Default: |
trim |
trim leading/trailing whitespace (if any) in cells? (default: |
data.frame
docx_extract_all
, docx_extract_tbl
,
assign_colnames
1 2 3 4 5 6 | doc3 <- read_docx(system.file("examples/data3.docx", package="docxtractr"))
docx_extract_tbl(doc3, 3)
intracell_whitespace <- read_docx(system.file("examples/preserve.docx", package="docxtractr"))
docx_extract_tbl(intracell_whitespace, 2, preserve=FALSE)
docx_extract_tbl(intracell_whitespace, 2, preserve=TRUE)
|
# A tibble: 6 x 2
Foo Bar
<chr> <chr>
1 Aa Bb
2 Dd Ee
3 Gg Hh
4 1 2
5 Zz Jj
6 Tt ii
# A tibble: 2 x 4
X Kite Lemur Madagascar
<chr> <chr> <chr> <chr>
1 Nanny Open Port Quarter
2 Rain Sand Television Unicorn
# A tibble: 2 x 4
X Kite Lemur Madagascar
<chr> <chr> <chr> <chr>
1 Nanny Open Port Quarter
2 Rain Sand Television Unicorn
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.