Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically generating package information from a smaller list #14

Open
njtierney opened this issue Feb 6, 2019 · 4 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@njtierney
Copy link
Contributor

@imkemayer and @SteffenMoritz: do you have any thoughts on how / if the package information can be added with some reference to a CRAN package link? Or would each page need to be generated manually?

Tools like pkgdown demonstrate that we could probably generate a short package description from a github/CRAN link. Hopefully that should mean that we don't have to generate the package description material each time.

@tuxette
Copy link
Member

tuxette commented Sep 23, 2019

The R function packageDescription can do the job if I understand well what you mean to do.

@njtierney
Copy link
Contributor Author

Yes! So something like this:

packageDescription("naniar", fields = "Description")
#> [1] "Missing values are ubiquitous in data and need to be explored and\n    handled in the initial stages of analysis. 'naniar' provides data structures \n    and functions that facilitate the plotting of missing values and examination \n    of imputations. This allows missing data dependencies to be explored with \n    minimal deviation from the common work patterns of 'ggplot2' and tidy data. "

Created on 2019-09-24 by the reprex package (v0.3.0)

@tuxette tuxette self-assigned this Sep 24, 2019
@tuxette tuxette added the enhancement New feature or request label Sep 24, 2019
@njtierney
Copy link
Contributor Author

Here is an example of how to do this:

library(glue)
library(stringr)
library(tibble)
library(purrr)

get_desc <- function(pkg){
  if (!requireNamespace(pkg, quietly = TRUE)) {
    stop(glue::glue("The package {pkg} is not installed"))
  }
  packageDescription(pkg, fields = "Description") %>%
    stringr::str_remove_all("\n") %>%
    stringr::str_remove_all("  ") %>%
    stringr::str_trim()
}

df_pkg <- tibble(pkgs = c("naniar", "mice", "mi"),
                 desc = map_chr(pkgs, get_desc))

df_pkg
#> # A tibble: 3 x 2
#>   pkgs   desc                                                              
#>   <chr>  <chr>                                                             
#> 1 naniar Missing values are ubiquitous in data and need to be explored and…
#> 2 mice   Multiple imputation using Fully Conditional Specification (FCS)im…
#> 3 mi     The mi package provides functions for data manipulation, imputing…

Created on 2019-09-24 by the reprex package (v0.3.0)

tuxette pushed a commit that referenced this issue Oct 29, 2019
@tuxette
Copy link
Member

tuxette commented Oct 29, 2019

solved in page rpkg. What remains to do:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants