Skip to content

Commit

Permalink
Merge commit '99990cb24167defd275852e244797c73ea2c4989'
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborcsardi committed Sep 24, 2023
2 parents 34f5d0e + 99990cb commit 1dc78b9
Show file tree
Hide file tree
Showing 43 changed files with 1,736 additions and 639 deletions.
7 changes: 6 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
^\.travis\.yml$
^tags$
^Makefile$
^README.md$
^README.Rmd$
^.travis.yml$
^appveyor.yml$
^data-raw$
^\.Rprofile$
^r-packages$
^revdep$
^\.github$
^codecov\.yml$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
62 changes: 62 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
#
# NOTE: This workflow is overkill for most R packages and
# check-standard.yaml is likely a better choice.
# usethis::use_github_action("check-standard") will install it.
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}

- {os: windows-latest, r: 'release'}
# Use 3.6 to trigger usage of RTools35
- {os: windows-latest, r: '3.6'}
# use 4.1 to check with rtools40's older compiler
- {os: windows-latest, r: '4.1'}

- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
- {os: ubuntu-latest, r: 'oldrel-2'}
- {os: ubuntu-latest, r: 'oldrel-3'}
- {os: ubuntu-latest, r: 'oldrel-4'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
48 changes: 48 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
release:
types: [published]
workflow_dispatch:

name: pkgdown

jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.4.1
with:
clean: false
branch: gh-pages
folder: docs
79 changes: 79 additions & 0 deletions .github/workflows/pr-commands.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
issue_comment:
types: [created]

name: Commands

jobs:
document:
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/document') }}
name: document
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/pr-fetch@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::roxygen2
needs: pr-document

- name: Document
run: roxygen2::roxygenise()
shell: Rscript {0}

- name: commit
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
git add man/\* NAMESPACE
git commit -m 'Document'
- uses: r-lib/actions/pr-push@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

style:
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/style') }}
name: style
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/pr-fetch@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- uses: r-lib/actions/setup-r@v2

- name: Install dependencies
run: install.packages("styler")
shell: Rscript {0}

- name: Style
run: styler::style_pkg()
shell: Rscript {0}

- name: commit
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
git add \*.R
git commit -m 'Style'
- uses: r-lib/actions/pr-push@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
50 changes: 50 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: test-coverage

jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr
needs: coverage

- name: Test coverage
run: |
covr::codecov(
quiet = FALSE,
clean = FALSE,
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
)
shell: Rscript {0}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/tags
/r-packages
/revdep
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

16 changes: 10 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
Package: prettyunits
Title: Pretty, Human Readable Formatting of Quantities
Version: 1.0.2.9000
Version: 1.1.1.9000
Authors@R: c(
person("Gabor", "Csardi", email="csardi.gabor@gmail.com", role=c("aut", "cre")),
person("Bill", "Denney", email="wdenney@humanpredictions.com", role=c("ctb"), comment=c(ORCID="0000-0002-5759-428X"))
)
Description: Pretty, human readable formatting of quantities.
Time intervals: 1337000 -> 15d 11h 23m 20s.
Vague time intervals: 2674000 -> about a month ago.
Bytes: 1337 -> 1.34 kB.
Colors: #FF0000 -> red.
Time intervals: '1337000' -> '15d 11h 23m 20s'.
Vague time intervals: '2674000' -> 'about a month ago'.
Bytes: '1337' -> '1.34 kB'.
Rounding: '99' with 3 significant digits -> '99.0'
p-values: '0.00001' -> '<0.0001'.
Colors: '#FF0000' -> 'red'.
License: MIT + file LICENSE
LazyData: true
URL: https://github.com/gaborcsardi/prettyunits
BugReports: https://github.com/gaborcsardi/prettyunits/issues
Depends:
R(>= 2.10)
Suggests:
codetools,
covr,
spacesXYZ,
testthat
RoxygenNote: 6.1.1
RoxygenNote: 7.2.3
Roxygen: list(markdown = TRUE)
Encoding: UTF-8
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

all: inst/README.md
all: README.md

inst/README.md: inst/README.Rmd
README.md: README.Rmd
Rscript -e "library(knitr); knit('$<', output = '$@', quiet = TRUE)"


8 changes: 8 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
# Generated by roxygen2: do not edit by hand

S3method(pretty_round,data.frame)
S3method(pretty_round,default)
S3method(pretty_signif,data.frame)
S3method(pretty_signif,default)
export(compute_bytes)
export(pretty_bytes)
export(pretty_color)
export(pretty_colour)
export(pretty_dt)
export(pretty_ms)
export(pretty_p_value)
export(pretty_round)
export(pretty_sec)
export(pretty_signif)
export(time_ago)
export(vague_dt)
importFrom(grDevices,col2rgb)
Expand Down
47 changes: 47 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

# development version

* New `pretty_round()` and `pretty_signif()` functions preserve the requested
number of digits as character strings (#14, @billdenney).

* New `pretty_p_value()` function to convert p-values to character strings
where small values are shown like "<0.0001" (#13, @billdenney).

* New `pretty_color()` functionm converts a color to a named color
(#12, @billdenney).

# 1.1.1

* Fix spurious zero fractions in `pretty_bytes()` when formatting
vectors of sizes (#23).

# 1.1.0

* `pretty_dt()`, `pretty_ms()` and `pretty_sec()` now handle `NA` values
properly, and return `NA_character_` for them (#10, @petermeissner).

* `pretty_bytes()` now formats quantities just below the units better.
E.g. 1MB - 1B is formatted as `"1 MB"` instead of `""1000 kB"` (#18).

* `pretty_bytes()` now has multiple styles. In particular, a fixed width
style is useful for progress bars. Another style avoids the left-padding
with spaces.

* The new low level `compute_bytes()` function can be used to create
custom formatters for bytes.

# 1.0.2

* `pretty_bytes()` always uses two fraction digits for non-integers.
This looks nicer in a progress bar, as the width of string does not
change so much.

# 1.0.1

First version with a NEWS file.

* Get rid of `R CMD check` notes.

# 1.0.0

Last version without a NEWS file.
Loading

0 comments on commit 1dc78b9

Please sign in to comment.