knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

lexl separates Excel formulas into tokens of different types, and gives their depth within a nested formula. Its name is a bad pun on 'Excel' and 'lexer'. Try the online demo or run demo_lexl() locally.

Example

library(lexl)
x <- lex_xl("MIN(3,MAX(2,A1))")
x

plot(x) # Requires the ggraph package

Parse tree

Not all parse trees are the same. The one given by lex_xl() is intended for analysis, rather than for computation. Examples of the kind of analysis that it might support are:

Where to find specimen formulas

The tidyxl package imports formulas from xlsx (spreadsheet) files.

The Enron corpus contains thousands of real-life spreadsheets.

Inspiration

Research by Felienne Hermans inspired this package, and the related XLParser project was a great help in creating the grammar.



nacnudus/lexl documentation built on May 15, 2019, 1:44 p.m.