Translated findOutRowsFromInd (#2)
Importing one more function from matlab2r
This commit is contained in:
parent
4a7cf802e8
commit
1462f6167f
3 changed files with 30 additions and 1 deletions
|
|
@ -52,6 +52,7 @@ importFrom(matlab2r,isspace)
|
||||||
importFrom(matlab2r,max)
|
importFrom(matlab2r,max)
|
||||||
importFrom(matlab2r,min)
|
importFrom(matlab2r,min)
|
||||||
importFrom(matlab2r,ones)
|
importFrom(matlab2r,ones)
|
||||||
|
importFrom(matlab2r,questdlg)
|
||||||
importFrom(matlab2r,rand)
|
importFrom(matlab2r,rand)
|
||||||
importFrom(matlab2r,repmat)
|
importFrom(matlab2r,repmat)
|
||||||
importFrom(matlab2r,reshape)
|
importFrom(matlab2r,reshape)
|
||||||
|
|
|
||||||
26
R/findOutRowsFromInd.R
Normal file
26
R/findOutRowsFromInd.R
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
findOutRowsFromInd <- function(popnames, rows, ploidisuus = NULL) {
|
||||||
|
if (is.null(ploidisuus)) {
|
||||||
|
ploidisuus <- questdlg(
|
||||||
|
quest = 'Specify the type of individuals in the data',
|
||||||
|
dlgtitle = 'Individual type?',
|
||||||
|
btn = c('Haploid', 'Diploid', 'Tetraploid'),
|
||||||
|
defbtn = 'Diploid'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
rowsFromInd <- switch(ploidisuus,
|
||||||
|
'Haploid' = 1,
|
||||||
|
'Diploid' = 2,
|
||||||
|
'Tetraploid' = 4
|
||||||
|
)
|
||||||
|
|
||||||
|
popnames2 <- popnames * NA
|
||||||
|
if (!is.null(popnames)) {
|
||||||
|
for (i in seq_len(size(rows, 1))) {
|
||||||
|
popnames2[i, 1] <- popnames[i, 1]
|
||||||
|
rivi <- rows[i, 1]:rows[i, 2]
|
||||||
|
popnames2[i, 2] <- rivi[rowsFromInd] / rowsFromInd
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(list(popnames2 = popnames2, rowsFromInd = rowsFromInd))
|
||||||
|
}
|
||||||
|
|
@ -5,6 +5,8 @@
|
||||||
#' @note Found a bug? Want to suggest a feature? Contribute to the scientific
|
#' @note Found a bug? Want to suggest a feature? Contribute to the scientific
|
||||||
#' and open source communities by opening an issue on our home page.
|
#' and open source communities by opening an issue on our home page.
|
||||||
#' Check the "BugReports" field on the package description for the URL.
|
#' Check the "BugReports" field on the package description for the URL.
|
||||||
#' @importFrom matlab2r blanks cell colon find inputdlg isempty isfield isspace max min ones rand repmat reshape size sortrows squeeze strcmp times zeros
|
#' @importFrom matlab2r blanks cell colon find inputdlg
|
||||||
|
#' isempty isfield isspace max min ones questdlg rand repmat reshape
|
||||||
|
#' size sortrows squeeze strcmp times zeros
|
||||||
#' @importFrom stats runif
|
#' @importFrom stats runif
|
||||||
NULL
|
NULL
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue