Skip to content

Commit

Permalink
Actually use tapply_identity()
Browse files Browse the repository at this point in the history
  • Loading branch information
ashbythorpe committed Oct 25, 2023
1 parent d81ae6e commit 0476486
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
14 changes: 0 additions & 14 deletions R/chrome.R
Original file line number Diff line number Diff line change
Expand Up @@ -125,20 +125,6 @@ chrome_check <- function(verbose, check = TRUE) {
list(yaml = cyml, platform = chromeplat)
}

# The same as tapply(x, y, identity), but works on older versions of R.
tapply_identity <- function(x, y) {
args <- c(
list(
function(x, ...) setNames(list(data.frame(...)), x),
y
),
x,
USE.NAMES = FALSE
)

as.array(do.call(mapply, args))
}

chrome_ver <- function(platform, version) {
chromever <- list_versions("chromedriver")[[platform]]
chromever <- if (identical(version, "latest")) {
Expand Down
17 changes: 16 additions & 1 deletion R/predl_chrome_for_testing.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,26 @@ predl_chrome_for_testing <- function(url, platform, history,
}
}
extracted <- do.call(rbind, lapply(ver_data, unwrap))
app_links <- tapply(extracted, extracted$platform, identity)
app_links <- tapply_identity(extracted, extracted$platform)
app_links <- app_links[platform]
assign_directory(app_links, appname)
}

# The same as tapply(x, y, identity), but works on older versions of R.
tapply_identity <- function(x, y) {
args <- c(
list(
function(x, ...) setNames(list(data.frame(...)), x),
y
),
x,
USE.NAMES = FALSE
)

as.array(do.call(mapply, args))
}


#' Unzip/untar the chromedriver file
#'
#' Unzip or untar a downloaded chromedriver file, then extract it from
Expand Down

0 comments on commit 0476486

Please sign in to comment.