From 74d8d8cab59907e69ecd983b79cb45143fb58cf8 Mon Sep 17 00:00:00 2001 From: Craig Williams Date: Thu, 28 Sep 2023 11:13:59 +0100 Subject: [PATCH] Something funky going on with the JSON unlist --- R/install_package_source.R | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/R/install_package_source.R b/R/install_package_source.R index 288a22d..7567c2e 100644 --- a/R/install_package_source.R +++ b/R/install_package_source.R @@ -9,14 +9,18 @@ #' @import parallel remotes #' @export install_package_source <- function(packageSource, installOpts = list(Ncpus = parallel::detectCores())) { + type <- unlist(packageSource$type) + src <- unlist(packageSource$src) + ref <- unlist(packageSource$ref) + package <- unlist(packageSource$package) packageRemote <- switch( - unlist(packageSource$type), - git_url = remotes:::git_remote(packageSource$src, ref = packageSource$ref), - github = remotes:::github_remote(packageSource$src, ref = packageSource$ref), - gitlab = remotes:::gitlab_remote(packageSource$src), - svn = remotes:::svn_remote(packageSource$src, revision = packageSource$ref), - bitbucket = remotes:::bitbucket_remote(packageSource$src, ref = packageSource$ref), - Bioconductor = remotes:::bio_remote(packageSource$src) + unlist(type), + git_url = remotes:::git_remote(src, ref = ref), + github = remotes:::github_remote(src, ref = ref), + gitlab = remotes:::gitlab_remote(src), + svn = remotes:::svn_remote(src, revision = ref), + bitbucket = remotes:::bitbucket_remote(src, ref = ref), + Bioconductor = remotes:::bio_remote(src) ) remotes:::install_remote(packageRemote, dependencies = NA, upgrade = "default", @@ -27,7 +31,7 @@ install_package_source <- function(packageSource, installOpts = list(Ncpus = par allPackages <- utils::installed.packages() allPackages <- as.data.frame(allPackages) - allPackages <- allPackages[allPackages$Package %in% packageSource$package,] + allPackages <- allPackages[allPackages$Package %in% package,] package <- data.frame( package = allPackages$Package, version = allPackages$Version