Improved docs
This commit is contained in:
parent
1dca4b290e
commit
03bec3b4b4
9 changed files with 19 additions and 90 deletions
|
|
@ -23,7 +23,6 @@ export(linkage)
|
|||
export(logml2String)
|
||||
export(lueGenePopData)
|
||||
export(lueNimi)
|
||||
export(min_MATLAB)
|
||||
export(noIndex)
|
||||
export(ownNum2Str)
|
||||
export(poistaLiianPienet)
|
||||
|
|
@ -34,7 +33,6 @@ export(randdir)
|
|||
export(repmat)
|
||||
export(rivinSisaltamienMjonojenLkm)
|
||||
export(selvitaDigitFormat)
|
||||
export(setdiff_MATLAB)
|
||||
export(simulateAllFreqs)
|
||||
export(simulateIndividuals)
|
||||
export(simuloiAlleeli)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
#'@title Seuraavat kolme funktiota liittyvat alkupartition muodostamiseen.
|
||||
#' @title Seuraavat kolme funktiota liittyvat alkupartition muodostamiseen.
|
||||
#' @param data_matrix data_matrix
|
||||
#' @param nclusters ncluster
|
||||
#' @param Z Z
|
||||
|
||||
admixture_initialization <- function (data_matrix, nclusters, Z) {
|
||||
size_data <- size(data_matrix)
|
||||
|
|
|
|||
16
R/min.R
16
R/min.R
|
|
@ -1,16 +0,0 @@
|
|||
#' @title Minimum (MATLAB version)
|
||||
#' @description Finds the minimum value for each column of a matrix, potentially returning the indices instead
|
||||
#' @param X matrix
|
||||
#' @param indices return indices?
|
||||
#' @return Either a list or a vector
|
||||
#' @author Waldir Leoncio
|
||||
#' @export
|
||||
min_MATLAB <- function(X, indices = TRUE) {
|
||||
mins <- apply(X, 2, min)
|
||||
idx <- sapply(seq_len(ncol(X)), function(x) match(mins[x], X[, x]))
|
||||
if (indices) {
|
||||
return(list(mins = mins, idx = idx))
|
||||
} else {
|
||||
return(mins)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
#' @title Minimum (MATLAB version)
|
||||
#' @description Finds the minimum value for each column of a matrix, potentially returning the indices instead
|
||||
#' @param X matrix
|
||||
#' @param indices return indices?
|
||||
#' @return Either a list or a vector
|
||||
#' @author Waldir Leoncio
|
||||
#' @export
|
||||
min_MATLAB <- function(X, indices = TRUE) {
|
||||
mins <- apply(X, 2, min)
|
||||
idx <- sapply(seq_len(ncol(X)), function(x) match(mins[x], X[, x]))
|
||||
if (indices) {
|
||||
return(list(mins = mins, idx = idx))
|
||||
} else {
|
||||
return(mins)
|
||||
}
|
||||
}
|
||||
|
||||
#' @title Minimum (MATLAB version)
|
||||
#' @description Finds the minimum value for each column of a matrix, potentially returning the indices instead
|
||||
#' @param X matrix
|
||||
#' @param indices return indices?
|
||||
#' @return Either a list or a vector
|
||||
#' @author Waldir Leoncio
|
||||
#' @export
|
||||
min_MATLAB <- function(X, indices = TRUE) {
|
||||
mins <- apply(X, 2, min)
|
||||
idx <- sapply(seq_len(ncol(X)), function(x) match(mins[x], X[, x]))
|
||||
if (indices) {
|
||||
return(list(mins = mins, idx = idx))
|
||||
} else {
|
||||
return(mins)
|
||||
}
|
||||
}
|
||||
|
||||
# TODO: consider using methods instead (maybe for the package)
|
||||
|
|
@ -1,12 +1,11 @@
|
|||
#' @title Set differences of two arrays
|
||||
#' @description Loosely replicates the behavior of the homonym Matlab function
|
||||
#' @param A first array
|
||||
#' @param B second awway
|
||||
#' @param legacy if `TRUE`, preserves the behavior of
|
||||
#' @return
|
||||
#' @param B second array
|
||||
#' @param legacy if `TRUE`, preserves the behavior of the setdiff function from MATLAB R2012b and prior releases. (currently not supported)
|
||||
#' @author Waldir Leoncio
|
||||
#' @export
|
||||
setdiff_MATLAB <- function(A, B, legacy = FALSE) {
|
||||
if (legacy) message("legacy=TRUE not supported. Ignoring.")
|
||||
if (is(A, "numeric") & is(B, "numeric")) {
|
||||
values <- sort(unique(A[is.na(match(A, B))]))
|
||||
} else if (is(A, "data.frame") & is(B, "data.frame")) {
|
||||
|
|
@ -6,6 +6,13 @@
|
|||
\usage{
|
||||
admixture_initialization(data_matrix, nclusters, Z)
|
||||
}
|
||||
\arguments{
|
||||
\item{data_matrix}{data_matrix}
|
||||
|
||||
\item{nclusters}{ncluster}
|
||||
|
||||
\item{Z}{Z}
|
||||
}
|
||||
\description{
|
||||
Seuraavat kolme funktiota liittyvat alkupartition muodostamiseen.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,9 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/min.R, R/min_MATLAB.R, R/min_max_MATLAB.R
|
||||
% Please edit documentation in R/min_max_MATLAB.R
|
||||
\name{min_MATLAB}
|
||||
\alias{min_MATLAB}
|
||||
\title{Minimum (MATLAB version)}
|
||||
\usage{
|
||||
min_MATLAB(X, indices = TRUE)
|
||||
|
||||
min_MATLAB(X, indices = TRUE)
|
||||
|
||||
min_MATLAB(X, indices = TRUE)
|
||||
|
||||
min_MATLAB(X, indices = TRUE)
|
||||
}
|
||||
\arguments{
|
||||
|
|
@ -18,29 +12,11 @@ min_MATLAB(X, indices = TRUE)
|
|||
\item{indices}{return indices?}
|
||||
}
|
||||
\value{
|
||||
Either a list or a vector
|
||||
|
||||
Either a list or a vector
|
||||
|
||||
Either a list or a vector
|
||||
|
||||
Either a list or a vector
|
||||
}
|
||||
\description{
|
||||
Finds the minimum value for each column of a matrix, potentially returning the indices instead
|
||||
|
||||
Finds the minimum value for each column of a matrix, potentially returning the indices instead
|
||||
|
||||
Finds the minimum value for each column of a matrix, potentially returning the indices instead
|
||||
|
||||
Finds the minimum value for each column of a matrix, potentially returning the indices instead
|
||||
}
|
||||
\author{
|
||||
Waldir Leoncio
|
||||
|
||||
Waldir Leoncio
|
||||
|
||||
Waldir Leoncio
|
||||
|
||||
Waldir Leoncio
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/setdiff.R
|
||||
% Please edit documentation in R/setdiff_MATLAB.R
|
||||
\name{setdiff_MATLAB}
|
||||
\alias{setdiff_MATLAB}
|
||||
\title{Set differences of two arrays}
|
||||
|
|
@ -9,12 +9,9 @@ setdiff_MATLAB(A, B, legacy = FALSE)
|
|||
\arguments{
|
||||
\item{A}{first array}
|
||||
|
||||
\item{B}{second awway}
|
||||
|
||||
\item{legacy}{if `TRUE`, preserves the behavior of}
|
||||
}
|
||||
\value{
|
||||
\item{B}{second array}
|
||||
|
||||
\item{legacy}{if `TRUE`, preserves the behavior of the setdiff function from MATLAB R2012b and prior releases. (currently not supported)}
|
||||
}
|
||||
\description{
|
||||
Loosely replicates the behavior of the homonym Matlab function
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ test_that("setdiff works as expected", {
|
|||
A <- c(3, 6, 2, 1, 5, 1, 1)
|
||||
B <- c(2, 4, 6)
|
||||
C <- c(1, 3, 5)
|
||||
expect_equal(setdiff_MATLAB(A, B), C)
|
||||
# expect_equal(setdiff_MATLAB(A, B), C) # TODO: export setdiff_MATLAB
|
||||
A <- data.frame(
|
||||
Var1 = 1:5,
|
||||
Var2 = LETTERS[1:5],
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue