diff --git a/NAMESPACE b/NAMESPACE index ef1906f..d864e27 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -24,6 +24,7 @@ export(rand) export(randdir) export(repmat) export(rivinSisaltamienMjonojenLkm) +export(selvitaDigitFormat) export(simulateAllFreqs) export(simulateIndividuals) export(simuloiAlleeli) diff --git a/R/selvitaDigitFormat.R b/R/selvitaDigitFormat.R new file mode 100644 index 0000000..81b3519 --- /dev/null +++ b/R/selvitaDigitFormat.R @@ -0,0 +1,31 @@ +#' @title Find out the Digit Format +#' @param line the first line after the "pop" word from data in Genepop format. # @note Function clarified based on the line format whether the alleles of the data are given using 2 or 3 numbers. +#' @return +#' @export +selvitaDigitFormat <- function(line) { + # line on ensimm�inen pop-sanan j�lkeinen rivi + # Genepop-formaatissa olevasta datasta. funktio selvitt�� + # rivin muodon perusteella, ovatko datan alleelit annettu + # 2 vai 3 numeron avulla. + + n <- 1 + merkki <- line[n] + while (merkki != ',') { + n <- n + 1 + merkki <- line[n] + } + + while (!any(merkki == '0123456789')) { + n <- n + 1 + merkki <- line[n] + } + numeroja <- 0 + while (any(merkki == '0123456789')) { + numeroja <- numeroja + 1 + n <- n + 1 + merkki <- line[n] + } + + df <- numeroja / 2 + return(df) +} \ No newline at end of file diff --git a/man/selvitaDigitFormat.Rd b/man/selvitaDigitFormat.Rd new file mode 100644 index 0000000..7d89daa --- /dev/null +++ b/man/selvitaDigitFormat.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/selvitaDigitFormat.R +\name{selvitaDigitFormat} +\alias{selvitaDigitFormat} +\title{Find out the Digit Format} +\usage{ +selvitaDigitFormat(line) +} +\arguments{ +\item{line}{the first line after the "pop" word from data in Genepop format. # @note Function clarified based on the line format whether the alleles of the data are given using 2 or 3 numbers.} +} +\value{ + +} +\description{ +Find out the Digit Format +}