-
Notifications
You must be signed in to change notification settings - Fork 15
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
Quantargo exercise - modify existing package #13
base: master
Are you sure you want to change the base?
Conversation
Fix usage example of windorize()
Codecov Report
@@ Coverage Diff @@
## master #13 +/- ##
=========================================
Coverage ? 90.47%
=========================================
Files ? 3
Lines ? 21
Branches ? 0
=========================================
Hits ? 19
Misses ? 2
Partials ? 0
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
Just found a few minor issues in the code.
@@ -1 +1,2 @@ | |||
exportPattern("^[[:alpha:]]+") | |||
importFrom("stats", "quantile") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not seem that the file has been created with roxygen2. Why?
@@ -1,4 +1,5 @@ | |||
#' Meanimputation | |||
#' @param x A vector |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please include a description of the function here.
@@ -0,0 +1,19 @@ | |||
#' transform_log | |||
#' Transform numerical values into their log values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should include an empty roxygen line between header and description.
@@ -0,0 +1,19 @@ | |||
#' transform_log | |||
#' Transform numerical values into their log values | |||
#' @param x A vector |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parameter description could be more specific here, e.g. indicating the data type.
#' | ||
transform_log <- function(x) { | ||
if (!is.numeric(x)) { | ||
warning("transform_log: Expecting numeric argument") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should stop here instead of indicating a warning. Implicit data type conversions can always lead to strange results.
if (!is.numeric(x)) { | ||
warning("transform_log: Expecting numeric argument") | ||
} | ||
x_badval <- is.na(suppressWarnings(as.numeric(x))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No implicit conversion should be done here, see previous comment.
if (p < 0 || p > 1) { | ||
stop("p invalid percentale. Expected values from 0 to 1") | ||
} | ||
q_lower <- quantile(x, (1-p)/2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if vector x
contains some NA
values here?
All issues are fixed.