From 47eb3f4e9039974fff78be86a78c4a42edc022c6 Mon Sep 17 00:00:00 2001 From: Waldir Leoncio Date: Tue, 14 Jan 2020 16:37:00 +0100 Subject: [PATCH] Improved documentation --- R/rand.R | 1 + R/repmat.R | 2 +- TODO.md | 12 ++++++------ man/computeIndLogml.Rd | 4 ++-- man/laskeMuutokset4.Rd | 8 ++++---- man/repmat.Rd | 2 +- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/R/rand.R b/R/rand.R index 9e23039..917f35a 100644 --- a/R/rand.R +++ b/R/rand.R @@ -4,6 +4,7 @@ #' @param c number of columns of output matrix #' @return \eqn{r \times c} matrix with random trials from a standard uniform distribution. #' @importFrom stats runif +#' @export rand <- function(r = 1, c = 1) { matrix(runif(r * c), r, c) } \ No newline at end of file diff --git a/R/repmat.R b/R/repmat.R index 45c23cd..fcc041f 100644 --- a/R/repmat.R +++ b/R/repmat.R @@ -3,7 +3,7 @@ #' @details This function was created to replicate the behavior of a homonymous #' function on Matlab #' @param mx matrix -#' @param n either a scalat with the number of replications in both rows and columns or a 2-length vector with individual repetitions. +#' @param n either a scalar with the number of replications in both rows and columns or a 2-length vector with individual repetitions. #' @return matrix replicated over `ncol(mx) * n` columns and `nrow(mx) * n` rows #' @note The Matlab implementation of this function accepts `n` with length > 2. #' @export diff --git a/TODO.md b/TODO.md index 1ba5df4..7476bbe 100644 --- a/TODO.md +++ b/TODO.md @@ -25,12 +25,12 @@ The list below contains non-essential but nice-to-have tasks for the next stable The following behavioral differences have been detected between the Matlab functions and their R counterparts. In order to save time, these differences will not be addressed, since they could require extensive reworking of a function. However, such differences may very well cause unexpected problems in some situations, which is why compiling this list is so important. The list below might provide a good starting point for identifying and fixing bugs: -Function | Argument | Value | Matlab output | R output ----------|----------|-------|---------------|--------- -`ownNum2Str` | `number` | `NaN` | `'NAN'` | error -`ownNum2Str` | `number` | `` | `''` | `''` + warning -`repmat` | `length(n)` | `> 2` | > 2D matrix | 2D matrix -`computeIndLogml` | only one of the arguments is negative | complex number | `NaN` +| Function | Argument | Value | Matlab output | R output | +| ----------------- | ------------------ | -------------- | --------------------- | ------------------------------- | +| `ownNum2Str` | `number` | `NaN` | `'NAN'` | error | +| `ownNum2Str` | `number` | `` | `''` | `''` + warning | +| `repmat` | `length(n)` | `> 2` | > 2D matrix | 2D matrix | +| `computeIndLogml` | some arguments < 0 | complex number | `NaN` | As general remarks, one should keep in mind that: diff --git a/man/computeIndLogml.Rd b/man/computeIndLogml.Rd index 6457c2b..c1d3f6e 100644 --- a/man/computeIndLogml.Rd +++ b/man/computeIndLogml.Rd @@ -7,9 +7,9 @@ computeIndLogml(omaFreqs, osuusTaulu) } \arguments{ -\item{omaFreqs}{omaFreqs} +\item{omaFreqs}{own Freqs?} -\item{osuusTaulu}{osuusTaulu} +\item{osuusTaulu}{Percentage table?} } \description{ Palauttaa yksilön logml:n, kun oletetaan yksilön alkuperät diff --git a/man/laskeMuutokset4.Rd b/man/laskeMuutokset4.Rd index f458d9e..bf7c6f4 100644 --- a/man/laskeMuutokset4.Rd +++ b/man/laskeMuutokset4.Rd @@ -7,13 +7,13 @@ laskeMuutokset4(osuus, osuusTaulu, omaFreqs, logml, COUNTS = matrix(0)) } \arguments{ -\item{osuus}{osuus} +\item{osuus}{Percentages?} -\item{osuusTaulu}{osuusTaulu} +\item{osuusTaulu}{Percentage table?} -\item{omaFreqs}{omaFreqs} +\item{omaFreqs}{own Freqs?} -\item{logml}{logml} +\item{logml}{log maximum likelihood} \item{COUNTS}{COUNTS} } diff --git a/man/repmat.Rd b/man/repmat.Rd index b17bddc..f05885b 100644 --- a/man/repmat.Rd +++ b/man/repmat.Rd @@ -9,7 +9,7 @@ repmat(mx, n) \arguments{ \item{mx}{matrix} -\item{n}{either a scalat with the number of replications in both rows and columns or a 2-length vector with individual repetitions.} +\item{n}{either a scalar with the number of replications in both rows and columns or a 2-length vector with individual repetitions.} } \value{ matrix replicated over `ncol(mx) * n` columns and `nrow(mx) * n` rows