r4epi / epikit Goto Github PK
View Code? Open in Web Editor NEWMiscellaneous helper tools for epidemiologists
Home Page: https://r4epi.github.io/epikit/
License: GNU General Public License v3.0
Miscellaneous helper tools for epidemiologists
Home Page: https://r4epi.github.io/epikit/
License: GNU General Public License v3.0
At the moment, the inline funs are lacking some test coverage. We should fix this.
@zkamvar - do we need to deal with notes from devtools::check()
{stats} is part of base at this point no?
── R CMD check results ──────────────────────────────────────────────────────── epikit 0.1.4 ────
Duration: 41.9s
❯ checking package dependencies ... NOTE
Package suggested but not available for checking: 'covr'
❯ checking R code for possible problems ... NOTE
add_weights_cluster: no visible global function definition for
'setNames'
Undefined global functions or variables:
setNames
Consider adding
importFrom("stats", "setNames")
to your NAMESPACE file.
0 errors ✔ | 0 warnings ✔ | 2 notes ✖
This can follow #2, basically
The idea of the find_start_date()
and find_end_date()
functions is excellent, and I find that the latter works exactly as intended. A really nice and useful function. However, I think there is an issue with find_start_date()
.
When trying to find the appropriate start date, you want the later of recall_begin
, date_join
, and date_born
, not the earlier. As it is currently implemented, it always returns the beginning of the recall period, even if someone joins or is born during the recall period. It works as intended for end dates, though, as you want the earlier date, not the later.
There are some inline functions that are super redundant and may be confusing to users. These should be removed
CRAN has been breathing down my neck about epikit and apyramid. Both of these are at risk of being archived (and a big headache for me) if I don't upload them by Tuesday.
Here are some failing checks that were fixed by Hadley a few weeks ago:
Version: 0.1.2
Check: tests
Result: ERROR
Running ‘testthat.R’ [4s/5s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> library(testthat)
> library(epikit)
>
> test_check("epikit")
[ FAIL 1 | WARN 1 | SKIP 1 | PASS 111 ]
══ Skipped tests ═══════════════════════════════════════════════════════════════
• On CRAN (1)
══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test-age-categories.R:179'): years alone give years ─────────────────
Error in `forcats::fct_drop(res, droppings)`: `only` must be a character vector or `NULL`, not a logical vector.
Backtrace:
▆
1. └─epikit::group_age_categories(df, years = years, one_column = FALSE) at test-age-categories.R:179:2
2. └─forcats::fct_drop(only = droppings)
3. └─forcats:::check_character(only, allow_null = TRUE)
4. └─forcats:::stop_input_type(...)
5. └─rlang::abort(message, ..., call = call, arg = arg)
[ FAIL 1 | WARN 1 | SKIP 1 | PASS 111 ]
Error: Test failures
Execution halted
Flavors: [r-devel-linux-x86_64-debian-clang](https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-debian-clang/epikit-00check.html), [r-patched-linux-x86_64](https://www.r-project.org/nosvn/R.check/r-patched-linux-x86_64/epikit-00check.html), [r-release-linux-x86_64](https://www.r-project.org/nosvn/R.check/r-release-linux-x86_64/epikit-00check.html)
The last set of checks that worked were from #31, so that's the version I am going to submit.
I am not going to submit the version as it is now with #32 because of two things:
because moved gen_polygon()
here and didnt update imports... like a numpty
Prepare for release:
usethis::use_cran_comments()
Remotes:
section for CRANdevtools::check()
devtools::check_win_devel()
rhub::check_for_cran()
Submit to CRAN:
usethis::use_version('minor')
cran-comments.md
devtools::submit_cran()
Wait for CRAN...
usethis::use_github_release()
usethis::use_dev_version()
usethis::use_news_md()
n.b. epimisc is technically already taken.
Since this is a more general-use package inline stuff and other things, it's not necessarily epi-related.
The case fatality rate needs to have the denominator be based on non-missing data rather than total number of rows. At the moment, it is based on the total number of rows, which could throw off the CFR:
Line 106 in d106e54
This should be fixed to be something more like dplyr::n() - sum(is.na(!!qdeath))
Problem:
When specific breaks are defined for the age_categories()
function, there is special formatting for the upper number, but the lower number is incorrectly formatted as a range with itself.
For example, if the lowest number is 0, the label for the first category will be 0-0
.
Proposed solution:
I think it should be reformatted to be less than the second number in the list of breaks, i.e. if the breaks are 0, 1, 5, 10
the first label should be <1
.
Reprex below:
# Load epikit:
library(epikit)
# Vector of ages in years:
age <- c(3, 1, 8, 1, 0.5, 6, 7, 2, 11, 15)
# Create age categories:
agegroups <- epikit::age_categories(x = age, breakers = c(0, 1, 5, 10))
# Combine into a data.frame and sort ascending by age:
df <- data.frame(age, agegroups) %>% arrange(age)
This gives the following results:
> df
age agegroups
1 0.5 0-0
2 1.0 1-4
3 1.0 1-4
4 2.0 1-4
5 3.0 1-4
6 6.0 5-9
7 7.0 5-9
8 8.0 5-9
9 11.0 10+
10 15.0 10+
Hello,
Would it be possible to add a "separator" argument to the unite_ci() function to be able to modify the default "--" between values?
It is sometimes changed to "to" or just "-"
Appreciate it.
Dear Zhian N. Kamvar,
This is an automated email to let you know that:
A new version of dplyr is ready to go to CRAN. dplyr is
currently at version 0.8.99.9002 and will become 1.0.0 upon release.
epikit uses dplyr and has problems with the new version.
We plan to submit dplyr to CRAN on May 1.
This is a major release. See
https://www.tidyverse.org/blog/2020/03/dplyr-1-0-0-is-coming-soon/ for
a detailed article about what's changed.
I need your help to keep epikit and dplyr working together smoothly.
In the next weeks, can you please:
Read about the changes to dplyr at
https://github.com/tidyverse/dplyr/blob/master/NEWS.md.
This page includes a list of breaking changes, the reasoning behind
them, and to how to update your code.
Carefully inspect the failing checks listed at the bottom of this email.
For each failing check, either update your package, or tell me
that I have a bug. If you have made changes to your package, please
submit an update to CRAN before May 1.
If you have discovered a bug in dplyr, please file an issue (ideally
with a small reprex that illustrates the problem) at
https://github.com/tidyverse/dplyr/issues. If you're not sure whether
or not you've found a bug, please file an issue at
https://github.com/tidyverse/dplyr/issues for discussion. Breaking
changes that are not listed qualify as bugs.
Please respond to this message if you have any questions.
Thanks,
Romain Francois
== CHECK RESULTS ========================================
Running examples in ‘epikit-Ex.R’ failed
The error most likely occurred in:
### Name: fmt_count
### Title: Counts and proportions inline
### Aliases: fmt_count
### ** Examples
fmt_count(mtcars, cyl > 3, hp < 100)
Error: `new` must be a tibble
Backtrace:
█
1. └─epikit::fmt_count(mtcars, cyl > 3, hp < 100)
2. └─dplyr::count(f)
3. └─dplyr::dplyr_reconstruct(out, x)
Execution halted
ERROR
Running the tests in ‘tests/testthat.R’ failed.
Last 13 lines of output:
5. dplyr::count(f)
6. dplyr::dplyr_reconstruct(out, x)
── 2. Failure: case_fatality_rate_df is equivalent to the non-df
version (@test-
`iris_res` not equal to `iris_expect`.
Attributes: < Component "class": Lengths (3, 1) differ (string
compare on first 1) >
Attributes: < Component "class": 1 string mismatch >
══ testthat results
═══════════════════════════════════════════════════════════
[ OK: 104 | SKIPPED: 1 | WARNINGS: 0 | FAILED: 2 ]
1. Error: fmt_count() works as expected (@test-inline_fun.R#65)
2. Failure: case_fatality_rate_df is equivalent to the non-df
version (@test-proportion.R#74)
Error: testthat unit tests failed
Execution halted
had commented some stuff out because erroring with the moving of props functions #32
need to fix up the examples appropratiely.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.