From 1e5fa0ea91e2ee323894604ba56fd93dfdbd2b26 Mon Sep 17 00:00:00 2001 From: Waldir Leoncio Date: Wed, 18 Mar 2020 15:02:38 +0100 Subject: [PATCH] Minor changes for clean build --- DESCRIPTION | 2 ++ NAMESPACE | 1 + R/admix1.R | 17 +++++++++++------ R/find.R | 1 + R/inputdlg.R | 2 +- R/noIndex.R | 2 ++ man/admix1.Rd | 8 +++++++- man/find.Rd | 3 +++ man/inputdlg.Rd | 2 +- man/noIndex.Rd | 5 +++++ 10 files changed, 34 insertions(+), 9 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 1fffe4a..a167a3b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -39,3 +39,5 @@ LazyData: true RoxygenNote: 7.0.2 Suggests: testthat (>= 2.1.0) +Imports: + methods diff --git a/NAMESPACE b/NAMESPACE index 816fc08..01d0b49 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -26,4 +26,5 @@ export(size) export(strcmp) export(suoritaMuutos) export(times) +importFrom(methods,is) importFrom(stats,runif) diff --git a/R/admix1.R b/R/admix1.R index 9cf5bb1..4ea8146 100644 --- a/R/admix1.R +++ b/R/admix1.R @@ -4,6 +4,11 @@ #' will the required variables be retrieved from the record fields? #' `tietue`should contain the following elements: PARTITION, COUNTS, SUMCOUNTS, #' alleleCodes, adjprior, popnames, rowsFromInd, data, npops, noalle +#' @param tietue tietue +#' @param PARTITION PARTITION +#' @param COUNTS COUNTS +#' @param SUMCOUNTS SUMCOUNTS +#' @importFrom methods is #' @export admix1 <- function(tietue, PARTITION = matrix(NA, 0, 0), COUNTS = matrix(NA, 0, 0), SUMCOUNTS = NA) { @@ -20,7 +25,7 @@ admix1 <- function(tietue, PARTITION = matrix(NA, 0, 0), cat('---------------------------------------------------\n'); message('Reading mixture result from: ', pathname_filename, '...') } - sys.sleep(0.0001) #ASK: what for? + Sys.sleep(0.0001) #ASK: what for? # ASK: what is this supposed to do? What do graphic obj have to do here? # h0 = findobj('Tag','filename1_text'); @@ -79,7 +84,7 @@ admix1 <- function(tietue, PARTITION = matrix(NA, 0, 0), ), definput = 5 ) - alaRaja <- as.num(answers) + alaRaja <- as.numeric(answers) npops <- poistaLiianPienet(npops, rowsFromInd, alaRaja) nloci <- size(COUNTS, 2) @@ -116,7 +121,7 @@ admix1 <- function(tietue, PARTITION = matrix(NA, 0, 0), # Yksil?on outlier } else if (PARTITION[ind] != 0) { if (PARTITION[ind] > 0) { - osuusTaulu(PARTITION[ind]) <- 1 + osuusTaulu[PARTITION[ind]] <- 1 } else { # Yksilöt, joita ei ole sijoitettu mihinkään koriin. arvot <- zeros(1, npops) @@ -181,12 +186,12 @@ admix1 <- function(tietue, PARTITION = matrix(NA, 0, 0), omaFreqs <- computePersonalAllFreqs( ind, data, allfreqs, rowsFromInd ) - osuusTaulu = zeros(1, npops) + osuusTaulu <- zeros(1, npops) if (PARTITION[ind] == 0) { # Yksil?on outlier } else if (PARTITION[ind] != 0) { if (PARTITION[ind] > 0) { - osuusTaulu(PARTITION[ind]) <- 1 + osuusTaulu[PARTITION[ind]] <- 1 } else { # Yksilöt, joita ei ole sijoitettu mihinkään koriin. arvot <- zeros(1, npops) @@ -388,7 +393,7 @@ admix1 <- function(tietue, PARTITION = matrix(NA, 0, 0), } } - if (!isstruct(tietue)) { + if (!is(tietue, "list")) { c$proportionsIt <- proportionsIt c$pvalue <- uskottavuus # Added by Jing c$mixtureType <- 'admix' # Jing diff --git a/R/find.R b/R/find.R index be417dd..45559c2 100644 --- a/R/find.R +++ b/R/find.R @@ -1,5 +1,6 @@ #' @title Find indices and values of nonzero elements #' @description Emulates behavior of `find` +#' @param x object or logic operation on an object find <- function(x) { if (is.logical(x)) { return(which(x)) diff --git a/R/inputdlg.R b/R/inputdlg.R index c803ddc..62414d0 100644 --- a/R/inputdlg.R +++ b/R/inputdlg.R @@ -1,7 +1,7 @@ #' @title Gather user input #' @description Replicates the functionality of the homonymous function in Matlab (sans dialog box) #' @param prompt Text field with user instructions -#' @param dim number of dimensions in the answwers +#' @param dims number of dimensions in the answwers #' @param definput default value of the input #' @export inputdlg <- function(prompt, definput=NULL, dims=1) { diff --git a/R/noIndex.R b/R/noIndex.R index 210ecd7..1fb52b0 100644 --- a/R/noIndex.R +++ b/R/noIndex.R @@ -3,6 +3,8 @@ #' @details As input, this function takes two variables from a mixture/admixture #' result structure. #' @return puredata: a data contains no index column. +#' @param data data +#' @param noalle noalle #' @export noIndex <- function (data, noalle) { limit <- ifelse(is(noalle, "matrix"), ncol(noalle), length(noalle)) diff --git a/man/admix1.Rd b/man/admix1.Rd index d792b04..5926a00 100644 --- a/man/admix1.Rd +++ b/man/admix1.Rd @@ -12,7 +12,13 @@ admix1( ) } \arguments{ -\item{tietue}{a named record list} +\item{tietue}{tietue} + +\item{PARTITION}{PARTITION} + +\item{COUNTS}{COUNTS} + +\item{SUMCOUNTS}{SUMCOUNTS} } \description{ Admixture analysis diff --git a/man/find.Rd b/man/find.Rd index be4de89..f7f4929 100644 --- a/man/find.Rd +++ b/man/find.Rd @@ -6,6 +6,9 @@ \usage{ find(x) } +\arguments{ +\item{x}{object or logic operation on an object} +} \description{ Emulates behavior of `find` } diff --git a/man/inputdlg.Rd b/man/inputdlg.Rd index 35096d6..26b8fa1 100644 --- a/man/inputdlg.Rd +++ b/man/inputdlg.Rd @@ -11,7 +11,7 @@ inputdlg(prompt, definput = NULL, dims = 1) \item{definput}{default value of the input} -\item{dim}{number of dimensions in the answwers} +\item{dims}{number of dimensions in the answwers} } \description{ Replicates the functionality of the homonymous function in Matlab (sans dialog box) diff --git a/man/noIndex.Rd b/man/noIndex.Rd index bf7e5a3..749b5fd 100644 --- a/man/noIndex.Rd +++ b/man/noIndex.Rd @@ -6,6 +6,11 @@ \usage{ noIndex(data, noalle) } +\arguments{ +\item{data}{data} + +\item{noalle}{noalle} +} \value{ puredata: a data contains no index column. }