knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" )
This package is now on CRAN.
install.packages("striprtf")
Alternatively, install development version from Github using devtools
library.
devtools::install_github("kota7/striprtf")
The package exports two main functions:
read_rtf
takes a path to a Rich Text Format (RTF) file and extracts plain text out of it.strip_rtf
does the same with string input instead of file path.library(striprtf) x <- read_rtf(system.file("extdata/king.rtf", package = "striprtf")) head(x)
The package has also been tested with documents in East Asian languages.
read_rtf(system.file("extdata/amenimo.rtf", package = "striprtf")) read_rtf(system.file("extdata/mean.rtf", package = "striprtf"))
From ver 0.3.1, the functions are renamed as follows:
striprtf
--> read_rtf
rtf2text
--> strip_rtf
See NEWS for other updates.
Supports tables in documents. Use row_start
, row_end
, cell_end
arguments
to adjust the format the tables.
Suppports line breaks (and other special characters) within cells.
The parser is made robust from v0.4.5.
Tested with files generated by Microsoft Word, Google Doc, and Libre Office Writer.
# example file added at v0.4.2 read_rtf(system.file("extdata/shakespeare.rtf", package = "striprtf"), row_start = "**", row_end = "", cell_end = " --- ")
Note:
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.