Improved documentation

This commit is contained in:
Waldir Leoncio 2020-01-14 16:37:00 +01:00
parent 06eb8e5433
commit 47eb3f4e90
6 changed files with 15 additions and 14 deletions

View file

@ -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)
}

View file

@ -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

12
TODO.md
View file

@ -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` | `<vector>` | `'<vector elements>'` | `'<vector elements>'` + 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` | `<vector>` | `'<vector elements>'` | `'<vector elements>'` + 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:

View file

@ -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

View file

@ -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}
}

View file

@ -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