Skip to contents

This function use `risk.assessr::assess_pkg` assessment function with only the package name and version

Usage

assess_pkg_r_package(package_name, version = NA, repos = NULL)

Arguments

package_name

A character string specifying the name of the package to assess.

version

A character string specifying the version of the package to assess. Default is `NA`, which assesses the latest version.

repos

A character string specifying the repo directly. Default is NULL, which uses the mirrors

Value

The function returns a list of assessment results generated by the `risk.assessr::assess_pkg` function. If the package cannot be downloaded or installed, an error message is returned.

Details

This function follows these steps:

  1. Downloads the specified R package

  2. Installs the downloaded package in a temporary location.

  3. Runs the `risk.assessr::assess_pkg` function to assess the package for risks and issues.

  4. Returns the results of the assessment.

Examples

# \donttest{
r <- getOption("repos")
# save current repo options  
old <- options(repos = r)
r["CRAN"] = "http://cran.us.r-project.org"
options(repos = r) 

results <- assess_pkg_r_package("here", version = "1.0.1")
#> Checking here on CRAN...
#> Trying http://cran.us.r-project.org
#> unpacking C:\Users\I0555262\AppData\Local\Temp\Rtmp0qLgLq\file51c8c23f0.tar.gz locally
#> unpacked C:\Users\I0555262\AppData\Local\Temp\Rtmp0qLgLq\file51c8c23f0.tar.gz locally
#> installing here locally
#> here is already installed
#> All exported functions have corresponding help files in here
#> here has bug reports URL
#> here has a maintainer
#> here has a website
#> here has a website
#> here has a source control
#> here has vignettes
#> here has examples
#> here has news
#> here has current news
#> checking package test config
#> running code coverage for here
#> code coverage for here successful
#> creating traceability matrix for here
#> Extracting exported function names for here
#> Extracting exported function bodies for here
#> creating traceability matrices for here with test coverage
#> traceability matrix for here unsuccessful
#> high risk coverage traceability matrix for here not generated
#> traceability matrix for here unsuccessful
#> medium risk coverage traceability matrix for here not generated
#> traceability matrix for here unsuccessful
#> imported functions traceability matrix for here not generated
#> traceability matrix for here unsuccessful
#> rexported functions traceability matrix for here not generated
#> traceability matrix for here unsuccessful
#> experimental functions traceability matrix for here not generated
#> traceability matrices for here successful
#> running rcmdcheck for here
#> ── R CMD build ─────────────────────────────────────────────────────────────────
#> * checking for file 'C:\Users\I0555262\AppData\Local\Temp\Rtmp0qLgLq\temp_file_51c83821537e\here/DESCRIPTION' ... OK
#> * preparing 'here':
#> * checking DESCRIPTION meta-information ... OK
#> * checking vignette meta-information ... OK
#> * checking for LF line-endings in source and make files and shell scripts
#> * checking for empty or unneeded directories
#> Omitted 'LazyData' from DESCRIPTION
#> * building 'here_1.0.1.tar.gz'
#> 
#> ── R CMD check ─────────────────────────────────────────────────────────────────
#> * using log directory 'C:/Users/I0555262/AppData/Local/Temp/Rtmp0qLgLq/file51c85d266359/here.Rcheck'
#> * using R version 4.2.2 (2022-10-31 ucrt)
#> * using platform: x86_64-w64-mingw32 (64-bit)
#> * using session charset: UTF-8
#> * using options '--no-examples --no-manual --ignore-vignettes'
#> * checking for file 'here/DESCRIPTION' ... OK
#> * this is package 'here' version '1.0.1'
#> * package encoding: UTF-8
#> * checking package namespace information ... OK
#> * checking package dependencies ... OK
#> * checking if this is a source package ... OK
#> * checking if there is a namespace ... OK
#> * checking for executable files ... OK
#> * checking for hidden files and directories ... OK
#> * checking for portable file names ... OK
#> * checking whether package 'here' can be installed ... OK
#> * checking installed package size ... OK
#> * checking package directory ... OK
#> * checking DESCRIPTION meta-information ... OK
#> * checking top-level files ... OK
#> * checking for left-over files ... OK
#> * checking index information ... OK
#> * checking package subdirectories ... OK
#> * checking R files for non-ASCII characters ... OK
#> * checking R files for syntax errors ... OK
#> * checking whether the package can be loaded ... OK
#> * checking whether the package can be loaded with stated dependencies ... OK
#> * checking whether the package can be unloaded cleanly ... OK
#> * checking whether the namespace can be loaded with stated dependencies ... OK
#> * checking whether the namespace can be unloaded cleanly ... OK
#> * checking dependencies in R code ... OK
#> * checking S3 generic/method consistency ... OK
#> * checking replacement functions ... OK
#> * checking foreign function calls ... OK
#> * checking R code for possible problems ... OK
#> * checking Rd files ... OK
#> * checking Rd metadata ... OK
#> * checking Rd cross-references ... OK
#> * checking for missing documentation entries ... OK
#> * checking for code/documentation mismatches ... OK
#> * checking Rd \usage sections ... OK
#> * checking Rd contents ... OK
#> * checking for unstated dependencies in examples ... OK
#> * checking installed files from 'inst/doc' ... OK
#> * checking files in 'vignettes' ... SKIPPED
#> * checking examples ... SKIPPED
#> * checking for unstated dependencies in 'tests' ... OK
#> * checking tests ...
#>   Running 'testthat.R'
#>  OK
#> * DONE
#> Status: OK
#> 
#> ERROR: Unknown command "TMPDIR=C:/Users/I0555262/AppData/Local/Temp/RtmpqorZyV/file5f406b9db40". Did you mean command "create-project"?
#> Error: Unknown command "TMPDIR=C:/Users/I0555262/AppData/Local/Temp/RtmpqorZyV/file5f406b9db40". Did you mean command "create-project"?
#>     at Command.parseArguments (file:///C:/PROGRA~1/Quarto/bin/quarto.js:8553:31)
#>     at Command.parseCommand (file:///C:/PROGRA~1/Quarto/bin/quarto.js:8320:31)
#>     at async quarto (file:///C:/PROGRA~1/Quarto/bin/quarto.js:127535:5)
#>     at async file:///C:/PROGRA~1/Quarto/bin/quarto.js:127553:9
#> Warning message:
#> In system2("quarto", "-V", stdout = TRUE, env = paste0("TMPDIR=",  :
#>   running command '"quarto" TMPDIR=C:/Users/I0555262/AppData/Local/Temp/RtmpqorZyV/file5f406b9db40 -V' had status 1
#> No forbidden notes for here
#> rcmdcheck for here passed
#> getting package dependencies for here
#> package dependencies successful for here
#> Extracting exported function names for here
#> Extracting exported function bodies for here
#> Checking for author in here
#> Checking for License in here
#> Checking host package
#> NO INTERNAL_RSPM FOUND
#> Checking GitHub data for r-lib/here...
#> getting reverse dependencies for here
#> reverse dependencies successful for here
#> Using package's default risk definition.

# restore user's repo options
options(old)

print(results)
#> $results
#> $results$pkg_name
#> [1] "here"
#> 
#> $results$pkg_version
#> [1] "1.0.1"
#> 
#> $results$pkg_source_path
#>   C:/Users/I0555262/AppData/Local/Temp/Rtmp0qLgLq/temp_file_51c83821537e/here 
#> "C:/Users/I0555262/AppData/Local/Temp/Rtmp0qLgLq/temp_file_51c83821537e/here" 
#> 
#> $results$date_time
#> [1] "2026-02-05 10:22:16"
#> 
#> $results$executor
#> [1] ""
#> 
#> $results$sysname
#> [1] "Windows"
#> 
#> $results$version
#> [1] "build 26100"
#> 
#> $results$release
#> [1] "10 x64"
#> 
#> $results$machine
#> [1] "x86-64"
#> 
#> $results$comments
#> [1] " "
#> 
#> $results$has_bug_reports_url
#> [1] "https://github.com/r-lib/here/issues"
#> 
#> $results$license_name
#> [1] "MIT + file LICENSE"
#> 
#> $results$has_examples
#> [1] 1
#> 
#> $results$has_maintainer
#> [1] "Kirill Müller <krlmlr+r@mailbox.org> [aut, cre] (<https://orcid.org/0000-0002-1416-3412>)"
#> 
#> $results$size_codebase
#> [1] 132
#> 
#> $results$has_news
#> [1] 1
#> 
#> $results$has_source_control
#> [1] "https://here.r-lib.org/, https://github.com/r-lib/here"
#> 
#> $results$has_vignettes
#> [1] 1
#> 
#> $results$has_website
#> [1] "https://here.r-lib.org/, https://github.com/r-lib/here"
#> 
#> $results$news_current
#> [1] 1
#> 
#> $results$export_help
#> [1] 1
#> 
#> $results$export_calc
#> [1] 1
#> 
#> $results$check
#> [1] 1
#> 
#> $results$covr
#> [1] 0.9867
#> 
#> $results$dependencies
#> $results$dependencies$imports
#> $results$dependencies$imports$rprojroot
#> [1] "2.1.1"
#> 
#> 
#> $results$dependencies$suggests
#> $results$dependencies$suggests$conflicted
#> [1] "1.2.0"
#> 
#> $results$dependencies$suggests$covr
#> [1] "3.6.5"
#> 
#> $results$dependencies$suggests$fs
#> [1] "1.6.6"
#> 
#> $results$dependencies$suggests$knitr
#> [1] "1.51"
#> 
#> $results$dependencies$suggests$palmerpenguins
#> [1] "0.1.1"
#> 
#> $results$dependencies$suggests$plyr
#> [1] "1.8.9"
#> 
#> $results$dependencies$suggests$readr
#> [1] "2.1.5"
#> 
#> $results$dependencies$suggests$rlang
#> [1] "1.1.7"
#> 
#> $results$dependencies$suggests$rmarkdown
#> [1] "2.30"
#> 
#> $results$dependencies$suggests$testthat
#> [1] "3.2.1.1"
#> 
#> $results$dependencies$suggests$uuid
#> [1] "1.2-1"
#> 
#> $results$dependencies$suggests$withr
#> [1] "3.0.2"
#> 
#> 
#> 
#> $results$suggested_deps
#> # A tibble: 1 × 4
#>   source suggested_function targeted_package message                                                  
#>   <chr>  <chr>                         <dbl> <chr>                                                    
#> 1 here   f                                 0 Please check if the targeted package should be in Imports
#> 
#> $results$rev_deps
#>   [1] "acledR"                  "adepro"                  "admiral"                
#>   [4] "AgePopDenom"             "aggreCAT"                "APCalign"               
#>   [7] "archetyper"              "artma"                   "ARUtools"               
#>  [10] "AzureAppInsights"        "bdc"                     "BeeBDC"                 
#>  [13] "blastula"                "boxr"                    "brandr"                 
#>  [16] "bscui"                   "bsitar"                  "cache"                  
#>  [19] "caretSDM"                "cbcTools"                "ciTools"                
#>  [22] "clockify"                "cnd"                     "CohortCharacteristics"  
#>  [25] "CohortConstructor"       "CohortSymmetry"          "configulaR"             
#>  [28] "cpsvote"                 "cricketdata"             "delimtools"             
#>  [31] "denguedatahub"           "designit"                "did"                    
#>  [34] "diffEnrich"              "diseasystore"            "DrugExposureDiagnostics"
#>  [37] "DrugUtilisation"         "dtrackr"                 "eemR"                   
#>  [40] "EIEntropy"               "elaborator"              "emayili"                
#>  [43] "envDocument"             "filecacher"              "flourishcharts"         
#>  [46] "flow"                    "folders"                 "formods"                
#>  [49] "froggeR"                 "fromhere"                "funspotr"               
#>  [52] "fusen"                   "fxl"                     "galaxias"               
#>  [55] "gghdx"                   "ggseg"                   "ghclass"                
#>  [58] "GIMMEgVAR"               "GISSB"                   "gitignore"              
#>  [61] "golem"                   "gooseR"                  "graphicalMCP"           
#>  [64] "gtakeout"                "gtfsrouter"              "Guerry"                 
#>  [67] "gutenbergr"              "heddlr"                  "heplots"                
#>  [70] "heritable"               "hkdatasets"              "hmde"                   
#>  [73] "IncidencePrevalence"     "ixplorer"                "jetty"                  
#>  [76] "justifier"               "k5"                      "kindisperse"            
#>  [79] "LifeInsureR"             "logitr"                  "logolink"               
#>  [82] "logrx"                   "longsurr"                "lterdatasampler"        
#>  [85] "mailmerge"               "maraca"                  "marginaleffects"        
#>  [88] "metabolic"               "MHQoL"                   "midfieldr"              
#>  [91] "MiscMetabar"             "mitey"                   "mlr3spatiotempcv"       
#>  [94] "morphemepiece"           "multiDoE"                "naijR"                  
#>  [97] "naniar"                  "nestedLogit"             "omopgenerics"           
#> [100] "OmopSketch"              "OmopViewer"              "organizr"               
#> [103] "outstandR"               "PatientProfiles"         "pharmr"                 
#> [106] "phdcocktail"             "PhenotypeR"              "phsmethods"             
#> [109] "phytoclass"              "popstudy"                "precommit"              
#> [112] "projects"                "PUMP"                    "r4lineups"              
#> [115] "rAccess"                 "RAINBOWR"                "rang"                   
#> [118] "rbranding"               "RcensusPkg"              "REDCapCAST"             
#> [121] "regions"                 "reticulate"              "ReviewR"                
#> [124] "rfold"                   "risk.assessr"            "rjtools"                
#> [127] "rnassqs"                 "RplotterPkg"             "rsf"                    
#> [130] "rUM"                     "rworkflows"              "salesforcer"            
#> [133] "SCDB"                    "SeaSondeR"               "SHAPforxgboost"         
#> [136] "shiny2docker"            "sitrep"                  "smdi"                   
#> [139] "socialmixr"              "spanishoddata"           "Spectran"               
#> [142] "srppp"                   "stRoke"                  "styler"                 
#> [145] "tatooheene"              "tcplfit2"                "tfrmtbuilder"           
#> [148] "tfruns"                  "tibble"                  "tidychangepoint"        
#> [151] "tidyprompt"              "tidyxl"                  "toxEval"                
#> [154] "tsgc"                    "tugboat"                 "unpivotr"               
#> [157] "upstartr"                "validateIt"              "vcdExtra"               
#> [160] "vegawidget"              "vembedr"                 "vigicaen"               
#> [163] "visOmopResults"          "vitals"                  "weed"                   
#> [166] "whep"                    "wither"                  "x3ptools"               
#> [169] "xpose"                   "yum"                    
#> 
#> $results$author
#> $results$author$maintainer
#> [1] "Kirill Müller <krlmlr+r@mailbox.org> [aut, cre] (<https://orcid.org/0000-0002-1416-3412>)"
#> 
#> $results$author$funder
#> NULL
#> 
#> $results$author$authors
#> [1] "Kirill Müller <krlmlr+r@mailbox.org> [aut, cre] (<https://orcid.org/0000-0002-1416-3412>)"
#> [2] "Jennifer Bryan <jenny@rstudio.com> [ctb] (<https://orcid.org/0000-0002-6983-2759>)"       
#> 
#> 
#> $results$host
#> $results$host$github_links
#> [1] "https://github.com/r-lib/here"
#> 
#> $results$host$cran_links
#> [1] "https://cran.r-project.org/src/contrib/Archive/here/here_1.0.1.tar.gz"
#> 
#> $results$host$internal_links
#> NULL
#> 
#> $results$host$bioconductor_links
#> NULL
#> 
#> 
#> $results$github_data
#> $results$github_data$created_at
#> [1] "2016-07-19"
#> 
#> $results$github_data$stars
#> [1] 431
#> 
#> $results$github_data$forks
#> [1] 46
#> 
#> $results$github_data$date
#> [1] "2026-02-05"
#> 
#> $results$github_data$recent_commits_count
#> [1] 4
#> 
#> $results$github_data$open_issues
#> [1] 40
#> 
#> 
#> $results$version_info
#> $results$version_info$all_versions
#> $results$version_info$all_versions[[1]]
#> $results$version_info$all_versions[[1]]$version
#> [1] "0.1"
#> 
#> $results$version_info$all_versions[[1]]$date
#> [1] "2017-05-28"
#> 
#> 
#> $results$version_info$all_versions[[2]]
#> $results$version_info$all_versions[[2]]$version
#> [1] "1.0.0"
#> 
#> $results$version_info$all_versions[[2]]$date
#> [1] "2020-11-15"
#> 
#> 
#> $results$version_info$all_versions[[3]]
#> $results$version_info$all_versions[[3]]$version
#> [1] "1.0.1"
#> 
#> $results$version_info$all_versions[[3]]$date
#> [1] "2020-12-13"
#> 
#> 
#> $results$version_info$all_versions[[4]]
#> $results$version_info$all_versions[[4]]$version
#> [1] "1.0.2"
#> 
#> $results$version_info$all_versions[[4]]$date
#> [1] "2025-09-15"
#> 
#> 
#> 
#> $results$version_info$last_version
#> $results$version_info$last_version$version
#> [1] "1.0.2"
#> 
#> $results$version_info$last_version$date
#> [1] "2025-09-15"
#> 
#> 
#> $results$version_info$difference_version_months
#> [1] 57
#> 
#> 
#> $results$download
#> $results$download$total_download
#> [1] 13867485
#> 
#> $results$download$last_month_download
#> [1] 318089
#> 
#> 
#> $results$tests
#> $results$tests$has_testthat
#> [1] TRUE
#> 
#> $results$tests$has_snaps
#> [1] TRUE
#> 
#> $results$tests$has_testit
#> [1] FALSE
#> 
#> $results$tests$n_golden_tests
#> [1] 2
#> 
#> $results$tests$n_test_files
#> [1] 4
#> 
#> 
#> 
#> $covr_list
#> $covr_list$total_cov
#> [1] 0.9867
#> 
#> $covr_list$res_cov
#> $covr_list$res_cov$name
#> [1] "here"
#> 
#> $covr_list$res_cov$coverage
#> $covr_list$res_cov$coverage$filecoverage
#>      R/aaa.R  R/dr_here.R     R/here.R     R/i_am.R R/set_here.R      R/zzz.R 
#>       100.00       100.00       100.00        95.83       100.00       100.00 
#> 
#> $covr_list$res_cov$coverage$totalcoverage
#> [1] 98.67
#> 
#> 
#> $covr_list$res_cov$errors
#> [1] NA
#> 
#> $covr_list$res_cov$notes
#> [1] NA
#> 
#> 
#> 
#> $tm_list
#> $tm_list$tm
#> # A tibble: 4 × 9
#>   exported_function class function_type    function_body         where code_script documentation description
#>   <chr>             <chr> <chr>            <chr>                 <chr> <chr>       <chr>         <chr>      
#> 1 dr_here           NA    regular function "{\n    message(form… here  R/dr_here.R dr_here.Rd    "\ndr_here…
#> 2 here              NA    regular function "{\n    .root_env$ro… here  R/here.R    here.Rd       "\nhere() …
#> 3 i_am              NA    regular function "{\n    stopifnot(le… here  R/i_am.R    i_am.Rd       "\nAdd a c…
#> 4 set_here          NA    regular function "{\n    path <- norm… here  R/set_here… set_here.Rd   "\nhtml<a …
#> # ℹ 1 more variable: coverage_percent <dbl>
#> 
#> $tm_list$coverage
#> $tm_list$coverage$high_risk
#> $tm_list$coverage$high_risk$pkg_name
#> [1] "here"
#> 
#> $tm_list$coverage$high_risk$coverage
#> $tm_list$coverage$high_risk$coverage$filecoverage
#> [1] 0
#> 
#> $tm_list$coverage$high_risk$coverage$totalcoverage
#> [1] 0
#> 
#> 
#> $tm_list$coverage$high_risk$errors
#> [1] NA
#> 
#> $tm_list$coverage$high_risk$notes
#> [1] NA
#> 
#> 
#> $tm_list$coverage$medium_risk
#> $tm_list$coverage$medium_risk$pkg_name
#> [1] "here"
#> 
#> $tm_list$coverage$medium_risk$coverage
#> $tm_list$coverage$medium_risk$coverage$filecoverage
#> [1] 0
#> 
#> $tm_list$coverage$medium_risk$coverage$totalcoverage
#> [1] 0
#> 
#> 
#> $tm_list$coverage$medium_risk$errors
#> [1] NA
#> 
#> $tm_list$coverage$medium_risk$notes
#> [1] NA
#> 
#> 
#> $tm_list$coverage$low_risk
#> # A tibble: 4 × 9
#>   exported_function class function_type    function_body         where code_script documentation description
#>   <chr>             <chr> <chr>            <chr>                 <chr> <chr>       <chr>         <chr>      
#> 1 dr_here           NA    regular function "{\n    message(form… here  R/dr_here.R dr_here.Rd    "\ndr_here…
#> 2 here              NA    regular function "{\n    .root_env$ro… here  R/here.R    here.Rd       "\nhere() …
#> 3 i_am              NA    regular function "{\n    stopifnot(le… here  R/i_am.R    i_am.Rd       "\nAdd a c…
#> 4 set_here          NA    regular function "{\n    path <- norm… here  R/set_here… set_here.Rd   "\nhtml<a …
#> # ℹ 1 more variable: coverage_percent <dbl>
#> 
#> 
#> $tm_list$function_type
#> $tm_list$function_type$defunct
#> # A tibble: 1 × 9
#>   exported_function class function_type    function_body         where code_script documentation description
#>   <chr>             <chr> <chr>            <chr>                 <chr> <chr>       <chr>         <chr>      
#> 1 set_here          NA    regular function "{\n    path <- norm… here  R/set_here… set_here.Rd   "\nhtml<a …
#> # ℹ 1 more variable: coverage_percent <dbl>
#> 
#> $tm_list$function_type$imported
#> $tm_list$function_type$imported$pkg_name
#> [1] "here"
#> 
#> $tm_list$function_type$imported$coverage
#> $tm_list$function_type$imported$coverage$filecoverage
#> [1] 0
#> 
#> $tm_list$function_type$imported$coverage$totalcoverage
#> [1] 0
#> 
#> 
#> $tm_list$function_type$imported$errors
#> [1] NA
#> 
#> $tm_list$function_type$imported$notes
#> [1] NA
#> 
#> 
#> $tm_list$function_type$rexported
#> $tm_list$function_type$rexported$pkg_name
#> [1] "here"
#> 
#> $tm_list$function_type$rexported$coverage
#> $tm_list$function_type$rexported$coverage$filecoverage
#> [1] 0
#> 
#> $tm_list$function_type$rexported$coverage$totalcoverage
#> [1] 0
#> 
#> 
#> $tm_list$function_type$rexported$errors
#> [1] NA
#> 
#> $tm_list$function_type$rexported$notes
#> [1] NA
#> 
#> 
#> $tm_list$function_type$experimental
#> $tm_list$function_type$experimental$pkg_name
#> [1] "here"
#> 
#> $tm_list$function_type$experimental$coverage
#> $tm_list$function_type$experimental$coverage$filecoverage
#> [1] 0
#> 
#> $tm_list$function_type$experimental$coverage$totalcoverage
#> [1] 0
#> 
#> 
#> $tm_list$function_type$experimental$errors
#> [1] NA
#> 
#> $tm_list$function_type$experimental$notes
#> [1] NA
#> 
#> 
#> 
#> 
#> $check_list
#> $check_list$res_check
#> ── R CMD check results ───────────────────────────────────────────────────────────────────── here 1.0.1 ────
#> Duration: 49.3s
#> 
#> 0 errors ✔ | 0 warnings ✔ | 0 notes ✔
#> 
#> $check_list$check_score
#> [1] 1
#> 
#> 
#> $risk_analysis
#> $risk_analysis$dependencies_count
#> [1] "low"
#> 
#> $risk_analysis$later_version
#> [1] "low"
#> 
#> $risk_analysis$code_coverage
#> [1] "low"
#> 
#> $risk_analysis$total_download
#> [1] "medium"
#> 
#> $risk_analysis$license
#> [1] "low"
#> 
#> $risk_analysis$reverse_dependencies_count
#> [1] "low"
#> 
#> $risk_analysis$documentation_score
#> [1] "low"
#> 
#> $risk_analysis$cmd_check
#> [1] "low"
#> 
#> 
# }