Skip to content

Commit b0309cd

Browse files
authored
R CMD check fixes (#22)
* wrap slow example in dontrun * fix Data masking and tidy selection NOTEs * fix false positive warning about pkg startup message * move pandoc to Suggests to remove 'too many deps' Note
1 parent 58ba751 commit b0309cd

7 files changed

Lines changed: 16 additions & 8 deletions

File tree

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ Imports:
3030
xml2,
3131
methods,
3232
S7,
33-
reticulate (>= 1.41.0.9001),
34-
pandoc,
33+
reticulate (>= 1.42.0),
3534
commonmark,
3635
blob,
3736
cli,
3837
curl,
3938
withr,
4039
dotty
4140
Suggests:
41+
pandoc,
4242
ellmer,
4343
knitr,
4444
readr,

R/ragnar-package.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ dotty::.
3131
file <- tempfile(fileext = ".txt")
3232
on.exit(unlink(file))
3333
writeLines("hi", file)
34+
(writeLines)("hi", file)
3435
convert <- init_markitdown()$convert
3536
DocumentConverterResult <- convert(file)
3637
if (inherits(DocumentConverterResult, "python.builtin.object")) {

R/read-html.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ ragnar_read_document <- function(x, ...,
325325
#' @export
326326
#'
327327
#' @examples
328+
#' \dontrun{
328329
#' ragnar_find_links("https://r4ds.hadley.nz/base-R.html")
329330
#' ragnar_find_links("https://ellmer.tidyverse.org/")
330331
#' ragnar_find_links("https://ellmer.tidyverse.org/", depth = 2)
@@ -335,6 +336,7 @@ ragnar_read_document <- function(x, ...,
335336
#' children_only = "https://github.com/Snowflake-Labs/sfquickstarts",
336337
#' depth = 1
337338
#' )
339+
#' }
338340
ragnar_find_links <- function(x, depth = 0L, children_only = TRUE, progress = TRUE, ...,
339341
url_filter = identity) {
340342

R/read-markdown.R

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ markdown_segment_text <- function(text, split_by = c("h1", "h2", "h3", "pre", "p
272272
## TOOD: probably better to use commonmark instead of pandoc here.
273273
tmp_html <- tempfile(fileext = ".html")
274274
on.exit(unlink(tmp_html))
275+
check_installed("pandoc")
275276
pandoc::pandoc_convert(text = text, to = "html", output = tmp_html)
276277
html_text3(doc = read_html(tmp_html, encoding = "UTF-8"),
277278
split_tags = split_by)
@@ -403,9 +404,11 @@ ragnar_read <- function(x, ..., split_by_tags = NULL, frame_by_tags = NULL) {
403404
frame[["tag"]] <- NULL
404405
}
405406

406-
frame <- frame |>
407-
dplyr::mutate(origin = x, hash = hash) |>
408-
dplyr::select(origin, hash, text, dplyr::everything())
407+
frame[["origin"]] <- x
408+
frame[["hash"]] <- hash
409+
410+
# reorder columns
411+
frame <- frame[unique(c("origin", "hash", names(frame), "text"))]
409412

410413
as_tibble(frame)
411414
}

R/retrieve.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ ragnar_retrieve_vss_and_bm25 <- function(store, text, top_k = 3, ...) {
150150
# pivot to wide format
151151
out <- tidyr::pivot_wider(
152152
out,
153-
names_from = metric_name,
154-
values_from = metric_value
153+
names_from = "metric_name",
154+
values_from = "metric_value"
155155
)
156156

157157
# TODO: come up with a nice reordering that doesn't involve too much compute.

R/store.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ ragnar_store_update <- function(store, chunks) {
267267
DBI::dbWriteTable(
268268
store@.con,
269269
"tmp_chunks",
270-
chunks |> dplyr::select(origin, hash) |> dplyr::distinct(),
270+
chunks |> dplyr::select("origin", "hash") |> dplyr::distinct(),
271271
temporary = TRUE,
272272
overwrite = TRUE
273273
)

man/ragnar_find_links.Rd

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)