Retain original column names (with space, line break)
Please find below a mininal example, with the example.docx example data.
library(docxtractr)
docxAll <- docxtractr::read_docx(path = "example.docx")
tbl <- docx_extract_tbl(docx = docxAll, tbl_number = 1, preserve = TRUE, trim = FALSE)
In docxtractr
version 0.5.0 from CRAN, the column names with space were retained:
tbl
# A tibble: 4 x 2
Column1 `Column 2 with spaceAnd with line break`
<chr> <chr>
1 1 blabla
2 2 blabla
3 3 blabla
4 3 blabla
In the version 0.6.5 (last version from CRAN), the spaces have been removed:
tbl
# A tibble: 4 x 2
Column1 Column.2.with.spaceAnd.with.line.break
<chr> <chr>
1 1 blabla
2 2 blabla
3 3 blabla
4 3 blabla
The issue seems to come from the addition of the make.names
call for the extraction of the column names in thedocx_extract_tbl
function.
This change was included in the version 0.6.1 of the package (see commit).
For my particular use case, it is important to retain the original column names included in the docx file (also included line break).
Would it be possible to support back the inclusion of the original column names in the header of the table?
Many thanks in advance for the support!