Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

otter

CRAN status Lifecycle: stable Codecov test coverage

otter is a small collection of functions that are useful for me, Ott, and hopefully for others too. Sharing is caring!

Currently otter provides rtf_to_df(), which parses RTF files and extracts embedded tables into a data frame. It automatically detects header rows, handles multi-page and multi-table RTF output, and supports non-UTF-8 encodings.

Installation

You can install the development version of otter from GitHub with:

# install.packages("pak")
pak::pak("ottvahtrik/otter")

Example

rtf_to_df() reads an RTF table and returns its contents as a data frame:

library(otter)

path <- system.file("extdata", "example.rtf", package = "otter")
rtf_to_df(path, include_header = TRUE)
#>    Name Value
#> 1 Alice    10
#> 2   Bob    20

If the RTF file contains multiple distinct tables, use table_index to select one of them:

multi_path <- system.file("extdata", "multi_table_example.rtf", package = "otter")
rtf_to_df(multi_path, include_header = TRUE, table_index = 2L)
#>   C D
#> 1 3 4

About

❗ This is a read-only mirror of the CRAN R package repository. otter — Ott's Utility Functions. Homepage: https://github.com/ottvahtrik/otterhttps://ottvahtrik.github.io/otter/ Report bugs for this package: https://github.com/ottvahtrik/otter/issues

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages