diff --git a/.Rbuildignore b/.Rbuildignore new file mode 100644 index 0000000..13e458c --- /dev/null +++ b/.Rbuildignore @@ -0,0 +1,2 @@ +^.*\.Rproj$ +^\.Rproj\.user$ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d44df33 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.Rproj.user +.Rhistory +.RData +.Ruserdata diff --git a/DESCRIPTION b/DESCRIPTION new file mode 100644 index 0000000..83934cd --- /dev/null +++ b/DESCRIPTION @@ -0,0 +1,11 @@ +Package: maRgheRitaR +Type: Package +Title: What the Package Does (Title Case) +Version: 0.1.0 +Author: Who wrote it +Maintainer: The package maintainer +Description: More about what it does (maybe more than one line) + Use four spaces when indenting paragraphs within the Description. +License: What license is it under? +Encoding: UTF-8 +LazyData: true \ No newline at end of file diff --git a/NAMESPACE b/NAMESPACE new file mode 100644 index 0000000..40ea8e2 --- /dev/null +++ b/NAMESPACE @@ -0,0 +1 @@ +exportPattern("^[[:alpha:]]+") diff --git a/R/center.R b/R/center.R new file mode 100644 index 0000000..3542987 --- /dev/null +++ b/R/center.R @@ -0,0 +1,17 @@ +#' Centering datasets +#' +#' Some more description +#' +#' And even more +#' +#' @param dataset The numeric vector to be centered +#' @param desired The numeric midpoint value around which the data will be centered +#' +#' @return A new vector containing the original data centered around the desired values +#' +#' @examples +# center(c(1,2,3),0) # should return -1 0 1 +# center(c(4,5,6),2) # should return 1 2 3 +center <- function(dataset, desired) { + dataset - mean(dataset) + desired +} diff --git a/R/rescale.R b/R/rescale.R new file mode 100644 index 0000000..1ee7405 --- /dev/null +++ b/R/rescale.R @@ -0,0 +1,12 @@ +#' Rescaling datasets +#' +#' @param v A numeric vector +#' +#' @return A new numeric vector, rescaled from the input vector to the range of 0 to 1 +#' +#' @examples +#' rescale(c(1,2,3)) # [1] 0.0 0.5 1.0 +#' rescale(c(1,2,3,4,5)) # [1] 0.00 0.25 0.50 0.75 1.00 +rescale <- function(v) { + (v - min(v)) / (max(v) - min(v)) +} diff --git a/maRgheRitaR.Rproj b/maRgheRitaR.Rproj new file mode 100644 index 0000000..b9255bc --- /dev/null +++ b/maRgheRitaR.Rproj @@ -0,0 +1,20 @@ +Version: 1.0 + +RestoreWorkspace: Default +SaveWorkspace: Default +AlwaysSaveHistory: Default + +EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 +Encoding: UTF-8 + +RnwWeave: Sweave +LaTeX: pdfLaTeX + +AutoAppendNewline: Yes +StripTrailingWhitespace: Yes + +BuildType: Package +PackageUseDevtools: Yes +PackageInstallArgs: --no-multiarch --with-keep.source