{attachment} is on CRAN !

May 7,2019

(This article was first published on (en) The R Task Force,and kindly contributed to 188bet appR-bloggers)

We are pleased to announce that our package {attachment} is now available on CRAN.The goal of attachment is to help to deal with package dependencies during package development.It also gives useful tools to install or list missing packages used inside Rscripts or Rmds.

Deal with dependencies during package development

If you ever had the following error when checking your package,{attachment} is for you:

R CMD check results 1 error | 0 warnings | 0 notes checking package dependencies … ERROR Namespace dependency not required: ‘collateral'

With this error,Colin would answer you:

Have you listed the package in the DESCRIPTION and in the NAMESPACE?

Indeed,the steps to deal with dependencies in your R functions when creating a package are:

  • Usepackage::functiondirectly in the code or list the function in the {roxygen2} header with@importFrom package function
  • Rundevtools::document()so thatfunctionappears in the NAMESPACE file
  • Add the {package} in the list ofDependsin the DESCRIPTION file

Also as you create a vignette and tests in your package,you need to remember to list packages in theSuggestssection of your DESCRIPTION file

{attachment} is here to help

Package {attachment} will do all the above steps for you.
Install the package from CRAN or from Github:

# From CRANinstall.packages("attachment")# From githubremotes::install_github("ThinkR-open/attachment")

If you correctly called the package dependencies in the {roxygen2} skeleton,在你的函数,in yourRmarkdownvignettes and in your tests,you only need to runattachment::att_to_description()just beforedevtools::check().And that's it,there is nothing else to remember !

Use {attachment} out of package development

{attachment} parses code of R scripts and Rmd.It lists all packages required to run that code.If you want to install all packages before trying to run the code of somebody else,you can use:

attachment::att_from_rmds(path = ".") %>% attachment::install_if_missing()attachment::att_from_rscripts(path = ".") %>% attachment::install_if_missing()

Also,if youbuild packagesorShiny Apps in packagesfor your delivery to your customers,or if you have to在客户的服务器上安装R产品,you will need to install all required packages before installation.A good start is to use a R script that lists all packages required.With functionattachment::create_dependencies_file(),you can build this kind of script:

# No Remotes ----# remotes::install_github("ThinkR-open/fcuk")# Attachments ----to_install <- c("covr","desc","devtools","glue","knitr",“magrittr”,"rmarkdown","stats","stringr","testthat","utils")for (i in to_install) {  message(paste("looking for ",i))  if (!requireNamespace(i)) {    message(paste("     installing",i))    install.packages(i)  }}

Documentation and participation

To read thefull documentation of package {attachment},you can follow this link to the {pkgodwn} site.

If you want toparticipate to the development,report bugs or propose pull requests,you will find the github page here.

Find our othercontributions to open-source and the R community here.

The post{attachment} is on CRAN !appeared first on(en) The R Task Force.

To leave a commentfor the author,please follow the link and comment on their blog: (en) The R Task Force.

188bet appR-bloggers.comoffers daily e-mail updates金宝搏网址 Rnews and tutorialson topics such as: Data science, Big Data, R jobs,visualization ( ggplot2, Boxplots, maps, animation),programming ( RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics ( regression, PCA, time series, trading) and more...

If you got this far,why not subscribe for updates from the site?Choose your flavor: e-mail, twitter, 1188bet app,or facebook...

Comments are closed.

Search 188bet appR-bloggers


Never miss an update!
Subscribe to 188bet appR-bloggersto receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)