@juliasilge I really like the janeaustenr package, so many thanks.
I am using it as an example to show that starting with a little "neat" R is often useful. I have 2 small suggestions:
a) The current version includes the library(dplyr) line, but there is no library(janeaustenr) line. Please could this be added.
b) Your book includes an even "tidier" version with four variables. Very nice. Could you include this function instead - or maybe as well? It is easy to copy from the book, but even easier if it could be included in the package.
library(janeaustenr)
library(dplyr)
library(stringr)
original_books <- austen_books() %>%
group_by(book) %>%
mutate(linenumber = row_number(),
chapter = cumsum(str_detect(text,
regex("^chapter [\\divxlc]",
ignore_case = TRUE)))) %>%
ungroup()
Happy New Year
Roger
@juliasilge I really like the janeaustenr package, so many thanks.
I am using it as an example to show that starting with a little "neat" R is often useful. I have 2 small suggestions:
a) The current version includes the
library(dplyr)line, but there is nolibrary(janeaustenr)line. Please could this be added.b) Your book includes an even "tidier" version with four variables. Very nice. Could you include this function instead - or maybe as well? It is easy to copy from the book, but even easier if it could be included in the package.
Happy New Year
Roger