From da6c38175f99737f38484f7dd58d6aaaa586cc8f Mon Sep 17 00:00:00 2001 From: Tyler Rinker <trinker@campuslabs.com> Date: Thu, 27 Sep 2018 10:29:33 -0400 Subject: [PATCH] app update --- inst/extract_text_app/app/extract_text.Rmd | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/inst/extract_text_app/app/extract_text.Rmd b/inst/extract_text_app/app/extract_text.Rmd index b813458..cf9b04d 100644 --- a/inst/extract_text_app/app/extract_text.Rmd +++ b/inst/extract_text_app/app/extract_text.Rmd @@ -52,8 +52,19 @@ mydata <- reactive({ req(input$file_input) in_file <- input$file_input - dplyr::data_frame(text = textreadr::read_document(in_file$datapath)) + ext <- tools::file_ext(in_file$datapath) + + switch(ext, + pdf = {textreadr::read_pdf(in_file$datapath)}, + doc = {textreadr::read_doc(in_file$datapath)}, + docx = {textreadr::read_docx(in_file$datapath)}, + rtf = {textreadr::read_rtf(in_file$datapath)}, + html = {textreadr::read_html(in_file$datapath)}, + stop("file type unsupported") + ) %>% + dplyr::as_tibble() + }) ```