Removed docs from matlab2r files (#21)
This commit is contained in:
parent
a381fde4bd
commit
69ca345f11
31 changed files with 39 additions and 661 deletions
33
NAMESPACE
33
NAMESPACE
|
|
@ -2,9 +2,7 @@
|
||||||
|
|
||||||
export(addAlleles)
|
export(addAlleles)
|
||||||
export(admix1)
|
export(admix1)
|
||||||
export(blanks)
|
|
||||||
export(calculatePopLogml)
|
export(calculatePopLogml)
|
||||||
export(colon)
|
|
||||||
export(computeAllFreqs2)
|
export(computeAllFreqs2)
|
||||||
export(computeIndLogml)
|
export(computeIndLogml)
|
||||||
export(computePersonalAllFreqs)
|
export(computePersonalAllFreqs)
|
||||||
|
|
@ -15,8 +13,6 @@ export(fopen)
|
||||||
export(greedyMix)
|
export(greedyMix)
|
||||||
export(handleData)
|
export(handleData)
|
||||||
export(initPopNames)
|
export(initPopNames)
|
||||||
export(inputdlg)
|
|
||||||
export(isfield)
|
|
||||||
export(laskeMuutokset4)
|
export(laskeMuutokset4)
|
||||||
export(learn_partition_modified)
|
export(learn_partition_modified)
|
||||||
export(learn_simple_partition)
|
export(learn_simple_partition)
|
||||||
|
|
@ -25,29 +21,20 @@ export(load_fasta)
|
||||||
export(logml2String)
|
export(logml2String)
|
||||||
export(lueGenePopData)
|
export(lueGenePopData)
|
||||||
export(lueNimi)
|
export(lueNimi)
|
||||||
export(matlab2r)
|
|
||||||
export(noIndex)
|
export(noIndex)
|
||||||
export(ownNum2Str)
|
export(ownNum2Str)
|
||||||
export(poistaLiianPienet)
|
export(poistaLiianPienet)
|
||||||
export(proportion2str)
|
export(proportion2str)
|
||||||
export(questdlg)
|
|
||||||
export(rand)
|
|
||||||
export(randdir)
|
export(randdir)
|
||||||
export(repmat)
|
|
||||||
export(rivinSisaltamienMjonojenLkm)
|
export(rivinSisaltamienMjonojenLkm)
|
||||||
export(selvitaDigitFormat)
|
export(selvitaDigitFormat)
|
||||||
export(simulateAllFreqs)
|
export(simulateAllFreqs)
|
||||||
export(simulateIndividuals)
|
export(simulateIndividuals)
|
||||||
export(simuloiAlleeli)
|
export(simuloiAlleeli)
|
||||||
export(size)
|
|
||||||
export(strcmp)
|
|
||||||
export(suoritaMuutos)
|
export(suoritaMuutos)
|
||||||
export(takeLine)
|
export(takeLine)
|
||||||
export(testaaOnkoKunnollinenBapsData)
|
export(testaaOnkoKunnollinenBapsData)
|
||||||
export(testaaPop)
|
export(testaaPop)
|
||||||
export(times)
|
|
||||||
export(uigetfile)
|
|
||||||
export(uiputfile)
|
|
||||||
export(writeMixtureInfo)
|
export(writeMixtureInfo)
|
||||||
import(utils)
|
import(utils)
|
||||||
importFrom(Rsamtools,scanBam)
|
importFrom(Rsamtools,scanBam)
|
||||||
|
|
@ -55,9 +42,27 @@ importFrom(adegenet,.readExt)
|
||||||
importFrom(adegenet,read.genepop)
|
importFrom(adegenet,read.genepop)
|
||||||
importFrom(ape,as.DNAbin)
|
importFrom(ape,as.DNAbin)
|
||||||
importFrom(ape,read.FASTA)
|
importFrom(ape,read.FASTA)
|
||||||
|
importFrom(matlab2r,blanks)
|
||||||
|
importFrom(matlab2r,cell)
|
||||||
|
importFrom(matlab2r,colon)
|
||||||
|
importFrom(matlab2r,inputdlg)
|
||||||
|
importFrom(matlab2r,isempty)
|
||||||
|
importFrom(matlab2r,isfield)
|
||||||
|
importFrom(matlab2r,isspace)
|
||||||
|
importFrom(matlab2r,max)
|
||||||
|
importFrom(matlab2r,min)
|
||||||
|
importFrom(matlab2r,ones)
|
||||||
|
importFrom(matlab2r,rand)
|
||||||
|
importFrom(matlab2r,repmat)
|
||||||
|
importFrom(matlab2r,reshape)
|
||||||
|
importFrom(matlab2r,size)
|
||||||
|
importFrom(matlab2r,sortrows)
|
||||||
|
importFrom(matlab2r,squeeze)
|
||||||
|
importFrom(matlab2r,strcmp)
|
||||||
|
importFrom(matlab2r,times)
|
||||||
|
importFrom(matlab2r,zeros)
|
||||||
importFrom(methods,is)
|
importFrom(methods,is)
|
||||||
importFrom(stats,runif)
|
importFrom(stats,runif)
|
||||||
importFrom(stats,sd)
|
importFrom(stats,sd)
|
||||||
importFrom(utils,read.delim)
|
importFrom(utils,read.delim)
|
||||||
importFrom(utils,write.table)
|
|
||||||
importFrom(vcfR,read.vcfR)
|
importFrom(vcfR,read.vcfR)
|
||||||
|
|
|
||||||
36
R/indMix.R
36
R/indMix.R
|
|
@ -150,8 +150,8 @@ indMix <- function(c, npops, dispText = TRUE) {
|
||||||
diffInCounts <- muutokset_diffInCounts$diffInCounts
|
diffInCounts <- muutokset_diffInCounts$diffInCounts
|
||||||
|
|
||||||
if (round == 1) {
|
if (round == 1) {
|
||||||
maxMuutos <- max_MATLAB(muutokset)$max
|
maxMuutos <- matlab2r::max(muutokset)$max
|
||||||
i2 <- max_MATLAB(muutokset)$idx
|
i2 <- matlab2r::max(muutokset)$idx
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i1 != i2 & maxMuutos > 1e-5) {
|
if (i1 != i2 & maxMuutos > 1e-5) {
|
||||||
|
|
@ -174,7 +174,7 @@ indMix <- function(c, npops, dispText = TRUE) {
|
||||||
partitionSummary <- temp_addToSum$partitionSummary
|
partitionSummary <- temp_addToSum$partitionSummary
|
||||||
added <- temp_addToSum$added
|
added <- temp_addToSum$added
|
||||||
if (added == 1) {
|
if (added == 1) {
|
||||||
temp_minMATLAB <- min_MATLAB(
|
temp_minMATLAB <- matlab2r::min(
|
||||||
partitionSummary[, 2]
|
partitionSummary[, 2]
|
||||||
)
|
)
|
||||||
worstLogml <- temp_minMATLAB$mins
|
worstLogml <- temp_minMATLAB$mins
|
||||||
|
|
@ -195,8 +195,8 @@ indMix <- function(c, npops, dispText = TRUE) {
|
||||||
)
|
)
|
||||||
muutokset <- muutokset_diffInCounts$muutokset
|
muutokset <- muutokset_diffInCounts$muutokset
|
||||||
diffInCounts <- muutokset_diffInCounts$diffInCounts
|
diffInCounts <- muutokset_diffInCounts$diffInCounts
|
||||||
isoin <- max_MATLAB(muutokset)[[1]]
|
isoin <- matlab2r::max(muutokset)[[1]]
|
||||||
indeksi <- max_MATLAB(muutokset)[[2]]
|
indeksi <- matlab2r::max(muutokset)[[2]]
|
||||||
if (isoin > maxMuutos) {
|
if (isoin > maxMuutos) {
|
||||||
maxMuutos <- isoin
|
maxMuutos <- isoin
|
||||||
i1 <- pop
|
i1 <- pop
|
||||||
|
|
@ -222,8 +222,8 @@ indMix <- function(c, npops, dispText = TRUE) {
|
||||||
partitionSummary <- temp_addToSum$partitionSummary
|
partitionSummary <- temp_addToSum$partitionSummary
|
||||||
added <- temp_addToSum$added
|
added <- temp_addToSum$added
|
||||||
if (added == 1) {
|
if (added == 1) {
|
||||||
worstLogml <- min_MATLAB(partitionSummary[, 2])[[1]]
|
worstLogml <- matlab2r::min(partitionSummary[, 2])[[1]]
|
||||||
worstIndex <- min_MATLAB(partitionSummary[, 2])[[2]]
|
worstIndex <- matlab2r::min(partitionSummary[, 2])[[2]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -247,8 +247,8 @@ indMix <- function(c, npops, dispText = TRUE) {
|
||||||
muutokset <- laskeMuutokset3(
|
muutokset <- laskeMuutokset3(
|
||||||
T2, inds2, rows, data, adjprior, priorTerm, pop
|
T2, inds2, rows, data, adjprior, priorTerm, pop
|
||||||
)
|
)
|
||||||
isoin <- max_MATLAB(muutokset)[[1]]
|
isoin <- matlab2r::max(muutokset)[[1]]
|
||||||
indeksi <- max_MATLAB(muutokset)[[2]]
|
indeksi <- matlab2r::max(muutokset)[[2]]
|
||||||
if (isoin > maxMuutos) {
|
if (isoin > maxMuutos) {
|
||||||
maxMuutos <- isoin
|
maxMuutos <- isoin
|
||||||
muuttuvaPop2 <- indeksi %% npops2
|
muuttuvaPop2 <- indeksi %% npops2
|
||||||
|
|
@ -289,8 +289,8 @@ indMix <- function(c, npops, dispText = TRUE) {
|
||||||
partitionSummary <- temp_addToSum$partitionSummary
|
partitionSummary <- temp_addToSum$partitionSummary
|
||||||
added <- temp_addToSum$added
|
added <- temp_addToSum$added
|
||||||
if (added == 1) {
|
if (added == 1) {
|
||||||
worstLogml <- min_MATLAB(partitionSummary[, 2])[[1]]
|
worstLogml <- matlab2r::min(partitionSummary[, 2])[[1]]
|
||||||
worstIndex <- min_MATLAB(partitionSummary[, 2])[[2]]
|
worstIndex <- matlab2r::min(partitionSummary[, 2])[[2]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -334,8 +334,8 @@ indMix <- function(c, npops, dispText = TRUE) {
|
||||||
diffInCounts <- muutokset_diffInCounts$diffInCounts
|
diffInCounts <- muutokset_diffInCounts$diffInCounts
|
||||||
|
|
||||||
muutokset[pop] <- -1e50 # Varmasti ei suurin!!!
|
muutokset[pop] <- -1e50 # Varmasti ei suurin!!!
|
||||||
maxMuutos <- max_MATLAB(muutokset)[[1]]
|
maxMuutos <- matlab2r::max(muutokset)[[1]]
|
||||||
i2 <- max_MATLAB(muutokset)[[2]]
|
i2 <- matlab2r::max(muutokset)[[2]]
|
||||||
updateGlobalVariables(
|
updateGlobalVariables(
|
||||||
ind, i2, diffInCounts, adjprior, priorTerm
|
ind, i2, diffInCounts, adjprior, priorTerm
|
||||||
)
|
)
|
||||||
|
|
@ -370,8 +370,8 @@ indMix <- function(c, npops, dispText = TRUE) {
|
||||||
partitionSummary <- temp_addToSum$partitionSummary
|
partitionSummary <- temp_addToSum$partitionSummary
|
||||||
added <- temp_addToSum$added
|
added <- temp_addToSum$added
|
||||||
if (added == 1) {
|
if (added == 1) {
|
||||||
worstLogml <- min_MATLAB(partitionSummary[, 2])[[1]]
|
worstLogml <- matlab2r::min(partitionSummary[, 2])[[1]]
|
||||||
worstIndex <- min_MATLAB(partitionSummary[, 2])[[2]]
|
worstIndex <- matlab2r::min(partitionSummary[, 2])[[2]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -441,7 +441,7 @@ indMix <- function(c, npops, dispText = TRUE) {
|
||||||
pop, emptyPop
|
pop, emptyPop
|
||||||
)
|
)
|
||||||
|
|
||||||
maxMuutos <- indeksi <- max_MATLAB(muutokset)
|
maxMuutos <- indeksi <- matlab2r::max(muutokset)
|
||||||
|
|
||||||
muuttuva <- inds2(indeksi)
|
muuttuva <- inds2(indeksi)
|
||||||
if (PARTITION(muuttuva) == pop) {
|
if (PARTITION(muuttuva) == pop) {
|
||||||
|
|
@ -474,8 +474,8 @@ indMix <- function(c, npops, dispText = TRUE) {
|
||||||
partitionSummary <- temp_addToSum$partitionSummary
|
partitionSummary <- temp_addToSum$partitionSummary
|
||||||
added <- temp_addToSum$added
|
added <- temp_addToSum$added
|
||||||
if (added == 1) {
|
if (added == 1) {
|
||||||
worstLogml <- min_MATLAB(partitionSummary[, 2])[[1]]
|
worstLogml <- matlab2r::min(partitionSummary[, 2])[[1]]
|
||||||
worstIndex <- min_MATLAB(partitionSummary[, 2])[[2]]
|
worstIndex <- matlab2r::min(partitionSummary[, 2])[[2]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (muutoksiaNyt == 0) {
|
if (muutoksiaNyt == 0) {
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@ linkage <- function(Y, method = "co") {
|
||||||
for (s in 1:(n - 1)) {
|
for (s in 1:(n - 1)) {
|
||||||
X <- as.matrix(as.vector(Y), ncol = 1)
|
X <- as.matrix(as.vector(Y), ncol = 1)
|
||||||
|
|
||||||
v <- min_MATLAB(X)$mins
|
v <- matlab2r::min(X)$mins
|
||||||
k <- min_MATLAB(X)$idx
|
k <- matlab2r::min(X)$idx
|
||||||
|
|
||||||
i <- floor(m + 1 / 2 - sqrt(m^2 - m + 1 / 4 - 2 * (k - 1)))
|
i <- floor(m + 1 / 2 - sqrt(m^2 - m + 1 / 4 - 2 * (k - 1)))
|
||||||
j <- k - (i - 1) * (m - i / 2) + i
|
j <- k - (i - 1) * (m - i / 2) + i
|
||||||
|
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/blanks.R
|
|
||||||
\name{blanks}
|
|
||||||
\alias{blanks}
|
|
||||||
\title{Blanks}
|
|
||||||
\usage{
|
|
||||||
blanks(n)
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{n}{length of vector}
|
|
||||||
}
|
|
||||||
\value{
|
|
||||||
Vector of n blanks
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
Create character vector of blanks
|
|
||||||
}
|
|
||||||
\details{
|
|
||||||
This function emulates the behavior of a homonimous function from Matlab
|
|
||||||
}
|
|
||||||
\author{
|
|
||||||
Waldir Leoncio
|
|
||||||
}
|
|
||||||
24
man/cell.Rd
24
man/cell.Rd
|
|
@ -1,24 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/cell.R
|
|
||||||
\name{cell}
|
|
||||||
\alias{cell}
|
|
||||||
\title{Cell array}
|
|
||||||
\usage{
|
|
||||||
cell(n, sz = c(n, n), expandable = FALSE, ...)
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{n}{a the first dimension (or both, if sz is not passed)}
|
|
||||||
|
|
||||||
\item{sz}{the second dimension (or 1st and 2nd, if not passed)}
|
|
||||||
|
|
||||||
\item{expandable}{if TRUE, output is a list (so it can take different
|
|
||||||
lengths)}
|
|
||||||
|
|
||||||
\item{...}{Other dimensions}
|
|
||||||
}
|
|
||||||
\value{
|
|
||||||
An array of zeroes with the dimensions passed on call
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
Creates an array of zeros
|
|
||||||
}
|
|
||||||
16
man/colon.Rd
16
man/colon.Rd
|
|
@ -1,16 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/colon.R
|
|
||||||
\name{colon}
|
|
||||||
\alias{colon}
|
|
||||||
\title{Vector creation}
|
|
||||||
\usage{
|
|
||||||
colon(a, b)
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{a}{initial number}
|
|
||||||
|
|
||||||
\item{b}{final number}
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
Simulates the function `colon()` and its equivalent `:` operator from Matlab, which have a similar but not quite equivalent behavior when compared to `seq()` and `:` in R.
|
|
||||||
}
|
|
||||||
16
man/find.Rd
16
man/find.Rd
|
|
@ -1,16 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/find.R
|
|
||||||
\name{find}
|
|
||||||
\alias{find}
|
|
||||||
\title{Find indices and values of nonzero elements}
|
|
||||||
\usage{
|
|
||||||
find(x, sort = TRUE)
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{x}{object or logic operation on an object}
|
|
||||||
|
|
||||||
\item{sort}{sort output?}
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
Emulates behavior of `find`
|
|
||||||
}
|
|
||||||
17
man/fix.Rd
17
man/fix.Rd
|
|
@ -1,17 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/fix.R
|
|
||||||
\name{fix}
|
|
||||||
\alias{fix}
|
|
||||||
\title{Round toward zero}
|
|
||||||
\usage{
|
|
||||||
fix(X)
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{X}{input element}
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
Rounds each element of input to the nearest integer towards zero. Basically the same as trunc()
|
|
||||||
}
|
|
||||||
\author{
|
|
||||||
Waldir Leoncio
|
|
||||||
}
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/inputdlg.R
|
|
||||||
\name{inputdlg}
|
|
||||||
\alias{inputdlg}
|
|
||||||
\title{Gather user input}
|
|
||||||
\usage{
|
|
||||||
inputdlg(prompt, dims = 1, definput = NULL)
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{prompt}{Text field with user instructions}
|
|
||||||
|
|
||||||
\item{dims}{number of dimensions in the answwers}
|
|
||||||
|
|
||||||
\item{definput}{default value of the input}
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
Replicates the functionality of the homonymous function in Matlab (sans dialog box)
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/isempty.R
|
|
||||||
\name{isempty}
|
|
||||||
\alias{isempty}
|
|
||||||
\title{Is Array Empty?}
|
|
||||||
\usage{
|
|
||||||
isempty(x)
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{x}{array}
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
Determine whether array is empty. An empty array, table, or timetable has at least one dimension with length 0, such as 0-by-0 or 0-by-5.
|
|
||||||
}
|
|
||||||
\details{
|
|
||||||
Emulates the behavior of the `isempty` function on Matlab
|
|
||||||
}
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/isfield.R
|
|
||||||
\name{isfield}
|
|
||||||
\alias{isfield}
|
|
||||||
\title{Checks if a list contains a field}
|
|
||||||
\usage{
|
|
||||||
isfield(x, field)
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{x}{list}
|
|
||||||
|
|
||||||
\item{field}{name of field}
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
This function tries to replicate the behavior of the `isfield`
|
|
||||||
function in Matlab
|
|
||||||
}
|
|
||||||
\references{
|
|
||||||
https://se.mathworks.com/help/matlab/ref/isfield.html
|
|
||||||
}
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/isspace.R
|
|
||||||
\name{isspace}
|
|
||||||
\alias{isspace}
|
|
||||||
\title{Determine space characters}
|
|
||||||
\usage{
|
|
||||||
isspace(A)
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{A}{a character array or a string scalar}
|
|
||||||
}
|
|
||||||
\value{
|
|
||||||
a vector TF such that the elements of TF are logical 1 (true) where corresponding characters in A are space characters, and logical 0 (false) elsewhere
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
Determine which characters are space characters
|
|
||||||
}
|
|
||||||
\note{
|
|
||||||
Recognized whitespace characters are ` ` and `\\t`.
|
|
||||||
}
|
|
||||||
\author{
|
|
||||||
Waldir Leoncio
|
|
||||||
}
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/matlab2r.R
|
|
||||||
\name{matlab2r}
|
|
||||||
\alias{matlab2r}
|
|
||||||
\title{Convert Matlab function to R}
|
|
||||||
\usage{
|
|
||||||
matlab2r(
|
|
||||||
filename,
|
|
||||||
output = "diff",
|
|
||||||
improve_formatting = TRUE,
|
|
||||||
change_assignment = TRUE,
|
|
||||||
append = FALSE
|
|
||||||
)
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{filename}{name of the file}
|
|
||||||
|
|
||||||
\item{output}{can be "asis", "clean", "save" or "diff"}
|
|
||||||
|
|
||||||
\item{improve_formatting}{if `TRUE` (default), makes minor changes
|
|
||||||
to conform to best-practice formatting conventions}
|
|
||||||
|
|
||||||
\item{change_assignment}{if `TRUE` (default), uses `<-` as the assignment operator}
|
|
||||||
|
|
||||||
\item{append}{if `FALSE` (default), overwrites file; otherwise, append
|
|
||||||
output to input}
|
|
||||||
}
|
|
||||||
\value{
|
|
||||||
text converted to R, printed to screen or replacing input file
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
Performs basic syntax conversion from Matlab to R
|
|
||||||
}
|
|
||||||
\note{
|
|
||||||
This function is intended to expedite the process of converting a
|
|
||||||
Matlab function to R by making common replacements. It does not have the
|
|
||||||
immediate goal of outputting a ready-to-use function. In other words,
|
|
||||||
after using this function you should go back to it and make minor changes.
|
|
||||||
|
|
||||||
It is also advised to do a dry-run with `output = "clean"` and only switching
|
|
||||||
to `output = "save"` when you are confident that no important code will be
|
|
||||||
lost (for shorter functions, a careful visual inspection should suffice).
|
|
||||||
}
|
|
||||||
\author{
|
|
||||||
Waldir Leoncio
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/min_max_MATLAB.R
|
|
||||||
\name{max_MATLAB}
|
|
||||||
\alias{max_MATLAB}
|
|
||||||
\title{Maximum (MATLAB version)}
|
|
||||||
\usage{
|
|
||||||
max_MATLAB(X, indices = TRUE)
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{X}{matrix}
|
|
||||||
|
|
||||||
\item{indices}{return indices?}
|
|
||||||
}
|
|
||||||
\value{
|
|
||||||
Either a list or a vector
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
Finds the minimum value for each column of a matrix, potentially returning the indices instead
|
|
||||||
}
|
|
||||||
\author{
|
|
||||||
Waldir Leoncio
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% 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)
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{X}{matrix}
|
|
||||||
|
|
||||||
\item{indices}{return indices?}
|
|
||||||
}
|
|
||||||
\value{
|
|
||||||
Either a list or a vector
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
Finds the minimum value for each column of a matrix, potentially returning the indices instead
|
|
||||||
}
|
|
||||||
\author{
|
|
||||||
Waldir Leoncio
|
|
||||||
}
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/nargin.R
|
|
||||||
\name{nargin}
|
|
||||||
\alias{nargin}
|
|
||||||
\title{Number of function input arguments}
|
|
||||||
\usage{
|
|
||||||
nargin()
|
|
||||||
}
|
|
||||||
\value{
|
|
||||||
An integer
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
Returns the number of arguments passed to the parent function
|
|
||||||
}
|
|
||||||
\note{
|
|
||||||
This function only makes sense inside another function
|
|
||||||
}
|
|
||||||
\references{
|
|
||||||
https://stackoverflow.com/q/64422780/1169233
|
|
||||||
}
|
|
||||||
\author{
|
|
||||||
Waldir Leoncio
|
|
||||||
}
|
|
||||||
19
man/ones.Rd
19
man/ones.Rd
|
|
@ -1,19 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/zeros_ones.R
|
|
||||||
\name{ones}
|
|
||||||
\alias{ones}
|
|
||||||
\title{Matrix of ones}
|
|
||||||
\usage{
|
|
||||||
ones(n1, n2 = n1, ...)
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{n1}{number of rows}
|
|
||||||
|
|
||||||
\item{n2}{number of columns}
|
|
||||||
|
|
||||||
\item{...}{extra dimensions}
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
wrapper of `zeros_or_ones()` that replicates the behavior of
|
|
||||||
the `ones()` function on Matlab
|
|
||||||
}
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/questdlg.R
|
|
||||||
\name{questdlg}
|
|
||||||
\alias{questdlg}
|
|
||||||
\title{Prompt for multiple-choice}
|
|
||||||
\usage{
|
|
||||||
questdlg(
|
|
||||||
quest,
|
|
||||||
dlgtitle = "",
|
|
||||||
btn = c("y", "n"),
|
|
||||||
defbtn = "n",
|
|
||||||
accepted_ans = c("y", "yes", "n", "no")
|
|
||||||
)
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{quest}{Question}
|
|
||||||
|
|
||||||
\item{dlgtitle}{Title of question}
|
|
||||||
|
|
||||||
\item{btn}{Vector of alternatives}
|
|
||||||
|
|
||||||
\item{defbtn}{Scalar with the name of the default option}
|
|
||||||
|
|
||||||
\item{accepted_ans}{Vector containing accepted answers}
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
This function aims to loosely mimic the behavior of the
|
|
||||||
questdlg function on Matlab
|
|
||||||
}
|
|
||||||
19
man/rand.Rd
19
man/rand.Rd
|
|
@ -1,19 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/rand.R
|
|
||||||
\name{rand}
|
|
||||||
\alias{rand}
|
|
||||||
\title{Generate matrix with U(0, 1) trials}
|
|
||||||
\usage{
|
|
||||||
rand(r = 1, c = 1)
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{r}{number of rows of output matrix}
|
|
||||||
|
|
||||||
\item{c}{number of columns of output matrix}
|
|
||||||
}
|
|
||||||
\value{
|
|
||||||
\eqn{r \times c} matrix with random trials from a standard uniform distribution.
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
Imitates the behavior of `rand()` on Matlab
|
|
||||||
}
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/repmat.R
|
|
||||||
\name{repmat}
|
|
||||||
\alias{repmat}
|
|
||||||
\title{Repeat matrix}
|
|
||||||
\usage{
|
|
||||||
repmat(mx, n)
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{mx}{matrix}
|
|
||||||
|
|
||||||
\item{n}{either a scalar with the number of replications in both rows and
|
|
||||||
columns or a <= 3-length vector with individual repetitions.}
|
|
||||||
}
|
|
||||||
\value{
|
|
||||||
matrix replicated over `ncol(mx) * n` columns and `nrow(mx) * n` rows
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
Repeats a matrix over n columns and rows
|
|
||||||
}
|
|
||||||
\details{
|
|
||||||
This function was created to replicate the behavior of a homonymous
|
|
||||||
function on Matlab
|
|
||||||
}
|
|
||||||
\note{
|
|
||||||
The Matlab implementation of this function accepts `n` with length > 2.
|
|
||||||
|
|
||||||
It should also be noted that a concatenated vector in R, e.g. `c(5, 2)`, becomes a column vector when coerced to matrix, even though it may look like a row vector at first glance. This is important to keep in mind when considering the expected output of this function. Vectors in R make sense to be seen as column vectors, given R's Statistics-oriented paradigm where variables are usually disposed as columns in a dataset.
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/reshape.R
|
|
||||||
\name{reshape}
|
|
||||||
\alias{reshape}
|
|
||||||
\title{Reshape array}
|
|
||||||
\usage{
|
|
||||||
reshape(A, sz)
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{A}{input matrix}
|
|
||||||
|
|
||||||
\item{sz}{vector containing the dimensions of the output vector}
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
Reshapes a matrix according to a certain number of dimensions
|
|
||||||
}
|
|
||||||
\details{
|
|
||||||
This function replicates the functionality of the `reshape()`
|
|
||||||
function on Matlab. This function is basically a fancy wrapper for the
|
|
||||||
`array()` function in R, but is useful because it saves the user translation
|
|
||||||
time. Moreover, it introduces validation code that alter the behavior of
|
|
||||||
`array()` and makes it more similar to `replicate()`.
|
|
||||||
}
|
|
||||||
\note{
|
|
||||||
The Matlab function also accepts as input the dismemberment of sz as
|
|
||||||
scalars.
|
|
||||||
}
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/setdiff_MATLAB.R
|
|
||||||
\name{setdiff_MATLAB}
|
|
||||||
\alias{setdiff_MATLAB}
|
|
||||||
\title{Set differences of two arrays}
|
|
||||||
\usage{
|
|
||||||
setdiff_MATLAB(A, B, legacy = FALSE)
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{A}{first array}
|
|
||||||
|
|
||||||
\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
|
|
||||||
}
|
|
||||||
\author{
|
|
||||||
Waldir Leoncio
|
|
||||||
}
|
|
||||||
23
man/size.Rd
23
man/size.Rd
|
|
@ -1,23 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/size.R
|
|
||||||
\name{size}
|
|
||||||
\alias{size}
|
|
||||||
\title{Size of an object}
|
|
||||||
\usage{
|
|
||||||
size(x, d)
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{x}{object to be evaluated}
|
|
||||||
|
|
||||||
\item{d}{dimension of object to be evaluated}
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
This functions tries to replicate the behavior of the base function "size" in Matlab
|
|
||||||
}
|
|
||||||
\note{
|
|
||||||
On MATLAB, size(1, 100) returns 1. As a matter of fact, if the user
|
|
||||||
calls for a dimension which x doesn't have `size()` always returns 1. R's
|
|
||||||
default behavior is more reasonable in those cases (i.e., returning NA),
|
|
||||||
but since the point of this function is to replicate MATLAB behaviors
|
|
||||||
(bugs and questionable behaviors included), this function also does this.
|
|
||||||
}
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/sortrows.R
|
|
||||||
\name{sortrows}
|
|
||||||
\alias{sortrows}
|
|
||||||
\title{Sort rows of matrix or table}
|
|
||||||
\usage{
|
|
||||||
sortrows(A, column = 1)
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{A}{matrix}
|
|
||||||
|
|
||||||
\item{column}{ordering column}
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
Emulates the behavior of the `sortrows` function on Matlab
|
|
||||||
}
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/squeeze.R
|
|
||||||
\name{squeeze}
|
|
||||||
\alias{squeeze}
|
|
||||||
\title{Squeeze}
|
|
||||||
\usage{
|
|
||||||
squeeze(A)
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{A}{input or array matrix}
|
|
||||||
}
|
|
||||||
\value{
|
|
||||||
An array with the same elements as the input array, but with
|
|
||||||
dimensions of length 1 removed.
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
Remove dimensions of length 1
|
|
||||||
}
|
|
||||||
\details{
|
|
||||||
This function implements the behavior of the homonimous function on
|
|
||||||
Matlab. `B = squeeze(A)` returns an array with the same elements as the
|
|
||||||
input array A, but with dimensions of length 1 removed. For example, if A is
|
|
||||||
a 3-by-1-by-1-by-2 array, then squeeze(A) returns a 3-by-2 matrix. If A is a
|
|
||||||
row vector, column vector, scalar, or an array with no dimensions of length
|
|
||||||
1, then squeeze returns the input A.
|
|
||||||
}
|
|
||||||
\note{
|
|
||||||
This is basically a wrapper of drop() with a minor adjustment to adapt
|
|
||||||
the output to what happens on Matlab
|
|
||||||
}
|
|
||||||
\author{
|
|
||||||
Waldir Leoncio
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/strcmp.R
|
|
||||||
\name{strcmp}
|
|
||||||
\alias{strcmp}
|
|
||||||
\title{Compare two character elements}
|
|
||||||
\usage{
|
|
||||||
strcmp(s1, s2)
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{s1}{first character element (string, vector or matrix)}
|
|
||||||
|
|
||||||
\item{s2}{second character element (string, vector or matrix)}
|
|
||||||
}
|
|
||||||
\value{
|
|
||||||
a logical element of the same type as the input
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
Logical test if two character elements are identical
|
|
||||||
}
|
|
||||||
22
man/times.Rd
22
man/times.Rd
|
|
@ -1,22 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/times.R
|
|
||||||
\name{times}
|
|
||||||
\alias{times}
|
|
||||||
\title{Element-wise matrix multiplication}
|
|
||||||
\usage{
|
|
||||||
times(a, b)
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{a}{first factor of the multiplication}
|
|
||||||
|
|
||||||
\item{b}{second factor of the multiplication}
|
|
||||||
}
|
|
||||||
\value{
|
|
||||||
matrix with dimensions equal to the larger of the two factors
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
Emulates the `times()` and `.*` operators from Matlab.
|
|
||||||
}
|
|
||||||
\details{
|
|
||||||
This function basically handles elements of different length better than the `*` operator in R, at least as far as behavior from a Matlab user is expecting.
|
|
||||||
}
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/uigetfile.R
|
|
||||||
\name{uigetfile}
|
|
||||||
\alias{uigetfile}
|
|
||||||
\title{Select a file for loading}
|
|
||||||
\usage{
|
|
||||||
uigetfile(filter = "", title = "")
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{filter}{Filter listed files}
|
|
||||||
|
|
||||||
\item{title}{Pre-prompt message}
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
Loosely mimics the functionality of the `uigetfile` function on
|
|
||||||
Matlab.
|
|
||||||
}
|
|
||||||
\references{
|
|
||||||
https://se.mathworks.com/help/matlab/ref/uigetfile.html
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/uiputfile.R
|
|
||||||
\name{uiputfile}
|
|
||||||
\alias{uiputfile}
|
|
||||||
\title{Save file}
|
|
||||||
\usage{
|
|
||||||
uiputfile(filter = ".rda", title = "Save file")
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{filter}{accepted file extension}
|
|
||||||
|
|
||||||
\item{title}{Title}
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
This function intends to loosely mimic the behaviour of the
|
|
||||||
homonymous Matlab function.
|
|
||||||
}
|
|
||||||
19
man/zeros.Rd
19
man/zeros.Rd
|
|
@ -1,19 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/zeros_ones.R
|
|
||||||
\name{zeros}
|
|
||||||
\alias{zeros}
|
|
||||||
\title{Matrix of zeros}
|
|
||||||
\usage{
|
|
||||||
zeros(n1, n2 = n1, ...)
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{n1}{number of rows}
|
|
||||||
|
|
||||||
\item{n2}{number of columns}
|
|
||||||
|
|
||||||
\item{...}{extra dimensions}
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
wrapper of `zeros_or_ones()` that replicates the behavior of
|
|
||||||
the `zeros()` function on Matlab
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/zeros_ones.R
|
|
||||||
\name{zeros_or_ones}
|
|
||||||
\alias{zeros_or_ones}
|
|
||||||
\title{Matrix of zeros or ones}
|
|
||||||
\usage{
|
|
||||||
zeros_or_ones(n, x)
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{n}{scalar or 2D vector}
|
|
||||||
|
|
||||||
\item{x}{value to fill matrix with}
|
|
||||||
}
|
|
||||||
\value{
|
|
||||||
n-by-n matrix filled with `x`
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
Generates a square or rectangular matrix of zeros or ones
|
|
||||||
}
|
|
||||||
\details{
|
|
||||||
This is a wrapper function to replicate the behavior of the
|
|
||||||
`zeros()` and the `ones()` functions on Matlab
|
|
||||||
}
|
|
||||||
\note{
|
|
||||||
Actually works for any `x`, but there's no need to bother imposing
|
|
||||||
validation controls here.
|
|
||||||
}
|
|
||||||
Loading…
Add table
Reference in a new issue