Skip to content

Commit deefcc7

Browse files
committed
fix: extr_iris working on openssl
1 parent cb6ed12 commit deefcc7

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

R/checks.R

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#' @param dat A dataframe that contains the data.
66
#' @param col_to_check The name of the column to check for NA values.
77
#' @param verbose Logical indicating whether to show a warning if NAs are found. Default is TRUE.
8-
#' @importFrom cli cli_warn
98
#' @keywords internal
109
#' @noRd
1110
check_na_warn <- function(dat, col_to_check, verbose = TRUE) {

R/extr_iris.R

+22-5
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,23 @@ extr_iris <- function(casrn = NULL, verbose = TRUE) {
2424
# Check if online
2525
check_internet(verbose = verbose)
2626

27+
28+
# Need to downgrade libcurl?
29+
if (isTRUE(check_need_libcurl_condathis())) {
30+
condathis_downgrade_libcurl()
31+
extr_iris_to_use <- extr_iris_openssl_
32+
} else {
33+
extr_iris_to_use <- extr_iris_
34+
}
35+
2736
if (length(casrn) > 1) {
28-
dat <- lapply(casrn, extr_iris_,
37+
dat <- lapply(casrn, extr_iris_to_use,
2938
cancer_types = cancer_types,
3039
verbose = verbose
3140
)
3241
out <- do.call(rbind, dat)
3342
} else {
34-
out <- extr_iris_(
43+
out <- extr_iris_to_use(
3544
casrn = casrn,
3645
cancer_types = cancer_types,
3746
verbose = verbose
@@ -130,7 +139,7 @@ extr_iris_ <- function(casrn = NULL,
130139
}
131140

132141

133-
#' extr_iris_linux
142+
#' extr_iris_openssl_
134143
#'
135144
#' @inheritParams extr_iris_
136145
extr_iris_openssl_ <- function(casrn,
@@ -161,9 +170,17 @@ extr_iris_openssl_ <- function(casrn,
161170
env_name = "openssl-linux-env", verbose = FALSE
162171
)
163172

164-
out <- curl_res$stdout |>
173+
dat <- curl_res$stdout |>
165174
rvest::read_html() |>
166175
rvest::html_table()
167176

168-
out[[1]]
177+
out <- dat[[1]][dat[[1]]$CASRN %in% casrn, ]
178+
179+
if (nrow(out) > 0) {
180+
out[, "query"] <- casrn
181+
} else {
182+
out[1, "query"] <- casrn
183+
}
184+
185+
out
169186
}

0 commit comments

Comments
 (0)