Skip to content

Conversation

@JosephSpejbl
Copy link

Following updates should significantly improve the package.

@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@c4b35b1). Click here to learn what that means.
The diff coverage is 90.47%.

Impacted file tree graph

@@           Coverage Diff            @@
##             master     #24   +/-   ##
========================================
  Coverage          ?   91.3%           
========================================
  Files             ?       3           
  Lines             ?      23           
  Branches          ?       0           
========================================
  Hits              ?      21           
  Misses            ?       2           
  Partials          ?       0
Impacted Files Coverage Δ
R/transform_log.R 100% <100%> (ø)
R/meanimpute.R 80% <66.66%> (ø)
R/windsorize.R 91.66% <91.66%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c4b35b1...1e649e7. Read the comment docs.

Copy link
Member

@mannau mannau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!
Just a few minor comments/issues

meanimpute <- function(x) {

if(is.null(x)) {stop("Input vector cannot be NULL.")}
if(all(is.na(x))) {stop("Input vector should contain at least one numeric element.")}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Being a bit picky here: ´Input vector should contain at least one numeric element which is not NA´.

@@ -0,0 +1,20 @@
#' transform_log
#'
#' log-transformation of a numeric vector. For details about log-transformation please see you basic school math textbook.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the last sentence and either think of

  1. Why log transformations are typically used and/or
  2. Hint to a Web link which describes the transformation in detail

transform_log <- function(x){

if( is.null(x) ) stop("Input vector is not allowed to be NULL.")
if( any(is.na(x)) ) stop("There is at least one NA value in input vector.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stop() could also be turned into a warning()

if( is.null(x) ) stop("Input vector is not allowed to be NULL.")
if( any(is.na(x)) ) stop("There is at least one NA value in input vector.")
if( any(x <= 0) ) stop("There is at least one negative value.")
if( any(is.numeric(x) == FALSE) ) stop("There is at least one non-numeric value.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better here use the negation sign: !is.numeric(x)


if(is.null(x)) {stop("Input vector cannot be NULL.")}
if(any(is.na(x))) {stop("There should be no NA's in input vector.")}
if(all(is.numeric(x)==FALSE)) {stop("There should only numeric values in the input vector.")}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, use the negation sign !

x

if(is.null(x)) {stop("Input vector cannot be NULL.")}
if(any(is.na(x))) {stop("There should be no NA's in input vector.")}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Why are no NA's allowed? What could be the workaround here to still windsorize and keep NAs?
  2. Typo: There should be no NA's in the input...

if(any(is.na(x))) {stop("There should be no NA's in input vector.")}
if(all(is.numeric(x)==FALSE)) {stop("There should only numeric values in the input vector.")}

if(is.na(p)==TRUE) {stop("Input quantile should be a number between 0 and 1 ")}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test does not match with the error message.

if(all(is.numeric(x)==FALSE)) {stop("There should only numeric values in the input vector.")}

if(is.na(p)==TRUE) {stop("Input quantile should be a number between 0 and 1 ")}
if(is.numeric(p)==FALSE) {stop("Input quantile should be a number between 0 and 1 ")}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Negation sign !.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants