Skip to content

Commit

Permalink
Use workaround for tapply() on older versions or R
Browse files Browse the repository at this point in the history
  • Loading branch information
ashbythorpe committed Oct 25, 2023
1 parent 460669f commit d81ae6e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
14 changes: 14 additions & 0 deletions R/chrome.R
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,20 @@ 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
3 changes: 0 additions & 3 deletions R/predl_chrome_for_testing.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ predl_chrome_for_testing <- function(url, platform, history,
}
extracted <- do.call(rbind, lapply(ver_data, unwrap))
app_links <- tapply(extracted, extracted$platform, identity)
print(names(app_links))
print(platform)
app_links <- app_links[platform]
print(app_links)
assign_directory(app_links, appname)
}

Expand Down

0 comments on commit d81ae6e

Please sign in to comment.