Skip to content

Commit

Permalink
fully implement #56 and add Munk to DESCRIPTION
Browse files Browse the repository at this point in the history
  • Loading branch information
pachadotdev committed Sep 19, 2024
1 parent 9a8319b commit 9b1d8fd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ Authors@R: c(
comment = "rOpenSci reviewer"),
person("Lincoln", "Mullen",
role = "ctb",
comment = "rOpenSci reviewer")
comment = "rOpenSci reviewer"),
person("Munk School of Global Affairs and Public Policy",
role = "fnd")
)
License: Apache License (>= 2)
URL: https://docs.ropensci.org/tabulapdf/ (website)
Expand Down
4 changes: 3 additions & 1 deletion R/locate_area.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,13 @@ locate_areas <- function(file,
file <- localize_file(file, copy = copy)
# on.exit(unlink(file), add = TRUE)
dims <- get_page_dims(file, pages = pages)

if (!is.null(thumbnails)) {
filelist <- list.files(path.expand(thumbnails), pattern = "\\.png$", ignore.case = TRUE, full.names = TRUE)
file.copy(filelist, tempdir(), overwrite = T)
paths <- file.path(tempdir(), basename(filelist))
cat("fetching files")
} else if (is.null(pages)) {
} else {
paths <- make_thumbnails(file,
outdir = tempdir(),
pages = pages,
Expand Down Expand Up @@ -127,6 +128,7 @@ extract_areas <- function(file,
extract_tables(
file = file,
pages = pages,
thumbnails = NULL,
area = areas,
guess = guess,
...
Expand Down
4 changes: 2 additions & 2 deletions vignettes/tabulapdf.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ The selection from Figure 1 can be used to extract the tables as follows:

```{r}
# manual selection, result transcribed below
# first_table <- locate_areas(f, pages = 2)
# second_table <- locate_areas(f, pages = 2)
# first_table <- locate_areas(f, pages = 2)[[1]]
# second_table <- locate_areas(f, pages = 2)[[1]]
first_table <- c(58.15032, 125.26869, 182.02355, 488.12966)
second_table <- c(387.7791, 125.2687, 513.7519, 492.3246)
Expand Down

0 comments on commit 9b1d8fd

Please sign in to comment.