Skip to content

Commit

Permalink
Merge pull request #30 from rempsyc/document_data
Browse files Browse the repository at this point in the history
Properly document lflags :D
  • Loading branch information
jimjam-slam authored Oct 10, 2023
2 parents 0f6e65c + 9f77b0d commit fb6ca53
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: ggflags
Type: Package
Version: 0.0.3
Version: 0.0.4
Title: Plot flags of the world in ggplot2
Authors@R: c(
person("Baptiste", "Auguie",
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# ggflags 0.0.4

- Some more internal rejiggering to ensure that you can use ggflags without explicitly loading the package
- If you're not loading the package and need to use it to plot things, prefix the package functions with `ggflags::` (eg. `ggflags::geom_flag`).
- If you need to access the internal flag list, either load it into the global environment as `lflags` using `data(lflags)` or access it prefixed with `ggflags::lflags`

# ggflags 0.0.3

- Adds Rémi Thériault as an author and contributor!
Expand Down
5 changes: 1 addition & 4 deletions R/geom_flag.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ makeContent.flag <- function(x) {
seq_along(x$country),
function(ii) {
grImport2::pictureGrob(
picture = .flaglist[[x$country[[ii]]]],
picture = ggflags::lflags[[x$country[[ii]]]],
x = x$x[ii], y = x$y[ii],
width = x$size[ii] * grid::unit(1, "mm"),
height = x$size[ii] * grid::unit(1, "mm"),
Expand All @@ -77,6 +77,3 @@ makeContent.flag <- function(x) {
)
grid::setChildren(x, do.call(grid::gList, flag_pics))
}

#' @noRd
utils::globalVariables(c(".flaglist"))
10 changes: 5 additions & 5 deletions R/lflags.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#' List of country flags
#'
#' @docType data
#' @format A data frame with X rows and X variables:
#' @format A list of 256 elements of class S4 (`grImport::Picture`), with:
#' \describe{
#' \item{state.name}{the name of the state}
#' \item{state.abb}{the name of the abbreviation}
#' \item{state.regex}{the regex for that state}
#' \item{content}{PictureGroup}
#' \item{defs}{PictureDefinitions}
#' \item{summary}{PictureSummary}
#' ...
#' }
".flaglist"
"lflags"
Binary file modified data/lflags.rda
Binary file not shown.
14 changes: 7 additions & 7 deletions man/dot-flaglist.Rd → man/lflags.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fb6ca53

Please sign in to comment.