Description Usage Arguments Examples
Read a backslash-coded lexicon file into a tibble
1 |
file |
either a path to a file, a connection, or literal data |
col_names |
names for line number and data columns (defaults to "line" and "data") |
remove |
Whether tidyr::extract should remove the "data" column |
... |
Further arguments passed to tidyr::extract |
1 2 3 4 5 6 7 8 9 10 | # Demo: Two literal backslash-coded lexemes
read_lexicon("\\lx bonjour\n\\de hello\n\n\\lx au revoir\n\\de goodbye")
# Demo: Extract backslash code and line value from data
read_lexicon("\\lx bonjour\n\\de hello\n\n\\lx au revoir\n\\de goodbye",
regex = "\\\\([a-z]+)\\s(.*)", into = c("code", "value"))
# More typical usage (where file path to a lexicon is known):
lexicon_file <- system.file("extdata", "mini-french.txt", package = "tidylex")
read_lexicon(file = lexicon_file, regex = "\\\\([a-z]+)\\s(.*)", into = c("code", "value"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.