knitr::opts_chunk$set(echo = TRUE)

R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

library(CausalityExtraction)
library(dplyr)

Inputs

path_file_single <- "./../inst/extdata/sample_documents/jv04amj.pdf"

path_folder <- "./../inst/extdata/sample_documents/"

path_file_mult <- list.files(
  recursive  = FALSE, 
  path       = path_folder, 
  pattern    = ".pdf", 
  full.names = TRUE
  )

Execute

Single File

df_1 <- CausalityExtraction(
  file_path = path_file_single
  )

df_1 %>% glimpse()

Multiple Files

df_2 <- CausalityExtraction(
  file_path = path_file_mult
  )

df_2 %>% glimpse()

Folder

df_3 <- CausalityExtraction(
  folder_path = path_folder
  )

df_3 %>% glimpse()
file_path <- c("/tmp/RtmpNFkBjP/ad5c78055376a890447a77d9/0.pdf", 
       "/tmp/RtmpNFkBjP/ad5c78055376a890447a77d9/1.pdf")

regex_file_name <- "([^/]+$)"

df <- data.frame(file_path)
df %>%
  dplyr::mutate(
    file_name = stringr::str_extract(x, regex_file_name)
  )


canfielder/CausalityExtraction documentation built on Jan. 5, 2022, 10:55 a.m.