Update package DESCRIPTION file Imports field

update_desc(path, overwrite = TRUE)

Arguments

path

character, path to R folder containing package functions

overwrite

logical, overwrite the file, Default: TRUE

Details

If overwrite is FALSE then the output will be returned to the console.

Examples

# copy dummy package to tempdir file.copy(system.file('pkg',package = 'sinew'),tempdir(),recursive = TRUE)
#> [1] TRUE
pkg_dir <- file.path(tempdir(),'pkg') pkg_dir_R <- file.path(pkg_dir,'R') pkg_dir_DESC <- file.path(pkg_dir,'DESCRIPTION') # update namespaces in package functions pretty_namespace(pkg_dir_R,overwrite = TRUE)
#> #> functions changed in '/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//RtmpsuvloD/pkg/R/yy.R': #> #> ✔: found, : not found, (): instances, ☒: user intervention #> #> ✔ utils::head (1) #> ✔ stats::runif (1) #> #> #> functions changed in '/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//RtmpsuvloD/pkg/R/zz.R': #> #> ✔: found, : not found, (): instances, ☒: user intervention #> #> ✔ utils::head (1) #> ✔ stats::runif (1) #>
# send result to the console update_desc(pkg_dir_R,overwrite = FALSE)
#> Imports: #> stats, #> utils
# overwrite the Imports field update_desc(pkg_dir_R,overwrite = TRUE) # view DESCRIPTION file cat(readLines(pkg_dir_DESC),sep='\n')
#> Package: pkg #> Title: What the Package Does (One Line, Title Case) #> Version: 0.0.0.9000 #> Authors@R: person(given = "First", family = "Last", role = c("aut", #> "cre"), email = "first.last@example.com", comment = c(ORCID = #> "YOUR-ORCID-ID")) #> Description: What the package does (one paragraph). #> License: MIT + file LICENSE #> Encoding: UTF-8 #> LazyData: true #> Roxygen: list(markdown = TRUE) #> RoxygenNote: 6.1.1 #> Imports: stats, utils
# cleanup tempdir unlink(pkg_dir,recursive = TRUE,force = TRUE)