Translated takeLine()

This commit is contained in:
Waldir Leoncio 2020-07-13 13:23:31 +02:00
parent 7f09e3a867
commit cc9704489c
4 changed files with 37 additions and 13 deletions

View file

@ -32,6 +32,7 @@ export(simuloiAlleeli)
export(size) export(size)
export(strcmp) export(strcmp)
export(suoritaMuutos) export(suoritaMuutos)
export(takeLine)
export(testaaOnkoKunnollinenBapsData) export(testaaOnkoKunnollinenBapsData)
export(testaaPop) export(testaaPop)
export(times) export(times)

View file

@ -1533,19 +1533,6 @@ greedyMix <- function(
# %-------------------------------------------------------------------- # %--------------------------------------------------------------------
# function newline = takeLine(description,width)
# %Returns one line from the description: line ends to the first
# %space after width:th mark.
# newLine = description(1:width);
# n = width+1;
# while ~isspace(description(n)) & n<length(description)
# n = n+1;
# end;
# newline = description(1:n);
# %-------------------------------------------------------
# function dist2 = laskeOsaDist(inds2, dist, ninds) # function dist2 = laskeOsaDist(inds2, dist, ninds)
# % Muodostaa dist vektorista osavektorin, joka sis<69>lt<6C><74> yksil<69>iden inds2 # % Muodostaa dist vektorista osavektorin, joka sis<69>lt<6C><74> yksil<69>iden inds2
# % v<>liset et<65>isyydet. ninds=kaikkien yksil<69>iden lukum<75><6D>r? # % v<>liset et<65>isyydet. ninds=kaikkien yksil<69>iden lukum<75><6D>r?

17
R/takeLine.R Normal file
View file

@ -0,0 +1,17 @@
#' @title Take line
#' @description Returns one line from the description.
#' @param description description
#' @param width width
#' @return newline
#' @export
takeLine <- function(description, width) {
# Returns one line from the description: line ends to the first
# space after width:th mark.
newLine <- description[1:width]
n <- width + 1
while ((description[n] != " ") & (n < length(description))) {
n <- n + 1
}
newline <- description[1:n]
return(newline)
}

19
man/takeLine.Rd Normal file
View file

@ -0,0 +1,19 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/takeLine.R
\name{takeLine}
\alias{takeLine}
\title{Take line}
\usage{
takeLine(description, width)
}
\arguments{
\item{description}{description}
\item{width}{width}
}
\value{
newline
}
\description{
Returns one line from the description.
}