Skip to content

Commit

Permalink
Release 1.0.3 (#53)
Browse files Browse the repository at this point in the history
* fix invisible dkde1d and clean-up

* prepare release

* use github actions (#52)

* try actions

* try fix

* try to add token
  • Loading branch information
tnagler authored Oct 26, 2020
1 parent cc8f548 commit fb84e0a
Show file tree
Hide file tree
Showing 34 changed files with 746 additions and 403 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ docs
^cran-comments\.md$
^revdep$
^.vscode$
^\.github$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
100 changes: 100 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# NOTE: This workflow is overkill for most R packages
# check-standard.yaml is likely a better choice
# usethis::use_github_action("check-standard") will install it.
#
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
on: [push, pull_request]

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'}
- {os: ubuntu-16.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest", http-user-agent: "R/4.0.0 (ubuntu-16.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" }
- {os: ubuntu-16.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
- {os: ubuntu-16.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@master
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}

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

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}

- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache@v1
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Install system dependencies
if: runner.os == 'Linux'
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "16.04"))')
- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
shell: Rscript {0}

- name: Session info
run: |
options(width = 100)
pkgs <- installed.packages()[, "Package"]
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}

- name: Check
env:
_R_CHECK_CRAN_INCOMING_: false
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}

- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check

- name: Test coverage
if: matrix.config.os == 'macOS-latest' && matrix.config.r == 'release'
run: |
Rscript -e 'remotes::install_github("r-lib/covr@gh-actions")'
Rscript -e 'covr::codecov(token = "${{secrets.CODECOV_TOKEN}}")'
36 changes: 0 additions & 36 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: kde1d
Type: Package
Title: Univariate Kernel Density Estimation
Version: 1.0.2
Version: 1.0.3
Authors@R: c(
person("Thomas", "Nagler",, "mail@tnagler.com", role = c("aut", "cre")),
person("Thibault", "Vatter",, "thibault.vatter@gmail.com", role = c("aut"))
Expand All @@ -25,7 +25,7 @@ Imports:
randtoolbox,
stats,
utils
RoxygenNote: 7.0.0
RoxygenNote: 7.1.1
Suggests:
testthat
URL: https://github.com/tnagler/kde1d
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# kde1d 1.0.3

BUG FIXES

* fix invisible output in `dkde1d()`.


# kde1d 1.0.2

BUG FIXES
Expand Down
34 changes: 2 additions & 32 deletions R/kde1d-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,38 +32,15 @@
#' @export
dkde1d <- function(x, obj) {
x <- prep_eval_arg(x, obj)
if (length(obj$jitter_info$i_disc) == 1) {
# for backwards compatibility with rvinecopulib
# TODO: remove next version
if (!is.ordered(x))
x <- ordered(x, obj$jitter_info$levels$x)
fhat <- dkde1d_cpp(as.numeric(x) - 1, obj)
f_all <- dkde1d_cpp(seq_along(obj$jitter_info$levels$x) - 1, obj)
fhat <- fhat / sum(f_all)
} else {
fhat <- dkde1d_cpp(x, obj)
}
dkde1d_cpp(x, obj)
}

#' @param q vector of quantiles.
#' @rdname dkde1d
#' @export
pkde1d <- function(q, obj) {
q <- prep_eval_arg(q, obj)
if (length(obj$jitter_info$i_disc) == 1) {
# for backwards compatibility with rvinecopulib
# TODO: remove next version
if (!is.ordered(q))
q <- ordered(q, obj$jitter_info$levels$x)
x_all <- as.ordered(obj$jitter_info$levels$x)
p_all <- dkde1d(x_all, obj)
p_total <- sum(p_all)
p <- sapply(q, function(y) sum(p_all[x_all <= y] / p_total))
p <- pmin(pmax(p, 0), 1)
} else {
p <- pkde1d_cpp(q, obj)
}
p
pkde1d_cpp(q, obj)
}

#' @param p vector of probabilities.
Expand All @@ -74,14 +51,7 @@ qkde1d <- function(p, obj) {
if (is.ordered(obj$x)) {
## for discrete variables, add factor levels
q <- ordered(levels(obj$x)[q + 1], levels(obj$x))
} else if (length(obj$jitter_info$i_disc) == 1) {
# for backwards compatibility with rvinecopulib
# TODO: remove next version
x_all <- as.ordered(obj$jitter_info$levels$x)
pp <- pkde1d(x_all, obj)
q <- x_all[vapply(p, function(y) which(y <= pp)[1], integer(1))]
}

q
}

Expand Down
5 changes: 0 additions & 5 deletions R/tools.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@ prep_eval_arg <- function(x, obj) {
return(x)

stopifnot(is.ordered(x))
if (length(obj$jitter_info$i_disc) == 1) {
# for backwards compatibility with rvinecopulib
# TODO: remove next version
return(x)
}

if (!all(levels(x) %in% levels(obj$x)))
stop("'x' contains levels that weren't present when fitting.")
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# kde1d

[![Build status Linux](https://travis-ci.org/tnagler/kde1d.svg?branch=master)](https://travis-ci.org/tnagler/kde1d)
[![Windows Build status](http://ci.appveyor.com/api/projects/status/github/tnagler/kde1d?svg=true)](https://ci.appveyor.com/project/tnagler/kde1d)
<!-- badges: start -->
[![R build status](https://github.com/tnagler/kde1d/workflows/R-CMD-check/badge.svg)](https://github.com/tnagler/kde1d/actions)
[![CRAN version](http://www.r-pkg.org/badges/version/kde1d)](https://cran.r-project.org/package=kde1d)
[![Coverage Status](https://img.shields.io/codecov/c/github/tnagler/kde1d/master.svg)](https://codecov.io/github/tnagler/kde1d?branch=master)
<!-- badges: end -->


### Summary
Expand Down
46 changes: 0 additions & 46 deletions appveyor.yml

This file was deleted.

34 changes: 22 additions & 12 deletions docs/404.html

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

Loading

0 comments on commit fb84e0a

Please sign in to comment.