-
Notifications
You must be signed in to change notification settings - Fork 14
Fixing all the Critical Points of datacleaner package for Quantargo training session. #4
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
base: master
Are you sure you want to change the base?
Changes from all commits
74118a5
4234834
e8be034
a91d273
53146f9
e31b333
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,5 @@ Encoding: UTF-8 | |
| LazyData: true | ||
| Suggests: | ||
| testthat, | ||
| covr, | ||
| rmarkdown | ||
| RoxygenNote: 6.1.1 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| exportPattern("^[[:alpha:]]+") | ||
| importFrom("stats", "quantile") | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,8 @@ | ||
| #' Meanimputation | ||
| #' | ||
| #' Removes NA-s with the mean value for the vector \code{x} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replaces... |
||
| #' | ||
| #' @param x A numeric vector | ||
| #' @export | ||
| meanimpute <- function(x) { | ||
| x[is.na(x)] <- mean(x, na.rm = TRUE) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| #' Log Transform | ||
| #' | ||
| #' Transform numerical values into their log values. | ||
| #' @param x A numeric vector. | ||
| #' @return The log values of \code{x}. | ||
| #' @examples | ||
| #' transform_log(exp(rnorm(7))) | ||
| #' @export | ||
|
|
||
| transform_log<- function( x ) | ||
| { | ||
| if( !is.numeric(x)) stop('Non numeric values found in passed paramenter.') | ||
| log(x ) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,20 @@ | ||
| #' Windsorize | ||
| #' | ||
| #' Do some windsorization. | ||
| #' Replacing values of vector \code{x} greater or smaller then \code{q} quantile values. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo: ... than ... |
||
| #' | ||
| #' @param x A numerical vector. | ||
| #' @param p Quantile value for outliers removal. | ||
| #' | ||
| #' @examples | ||
| #' windsorize(c(1,499,500,501)) | ||
| #' @export | ||
| #' | ||
| windsorize <- function(x, p = .90) { | ||
| q <- quantile(x, p) | ||
| x[x >= q] <- q | ||
| if(length(x) == 0) stop('Empty vector passed as an argument.') | ||
| if( sum(is.na(x)) == length(x) ) stop('A vector of NA-s passed as an argument') | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. More explicit to use |
||
| q <- quantile(x, probs = c(1-p,p), na.rm = TRUE) | ||
| x[x >= q[2] ] <- q[2] | ||
| x[x <= q[1] ] <- q[1] | ||
| x | ||
| } | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Have you used roxygen2 to generate the
NAMESPACEfile?