Learn R Programming

docxtractr (version 0.1.0.9000)

docx_extract_tbl: Extract a table from a Word document

Description

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.

Usage

docx_extract_tbl(docx, tbl_number = 1, header = TRUE, trim = TRUE)

Arguments

docx
docx object read with read_docx
tbl_number
which table to extract (defaults to 1)
header
assume first row of table is a header row? (default; TRUE)
trim
trim leading/trailing whitespace (if any) in cells? (default: TRUE)

Value

data.frame

See Also

docx_extract_all, docx_extract_tbl, assign_colnames

Examples

Run this code
doc3 <- read_docx(system.file("examples/data3.docx", package="docxtractr"))
docx_extract_tbl(doc3, 3)

Run the code above in your browser using DataLab