text-indexing: gives the absolute positions of (row,column) positions within...

Description Usage Arguments Details Value Examples

Description

(text3ij2n) returns numerical values equal to the rank of a position when all lines of the text are concatenated without separators.
(text3n2ij) returns the (line, column) position associated to an absolute position when the lines of the text are concatanated.
In fact, the reverse of text3ij2n.

Usage

1
2
3
 
  text3ij2n(ij,text,flexible=TRUE) 
  text3n2ij(n,text,flexible=TRUE) 

Arguments

ij

A numeric(2) indicating (line,column) of the position. May also be a matrix with two columns.

text

A character vector containing the text (a component, a line).

n

A numeric(1) indicating the absolute position. May also be a vector. Values outside the possible range are bounded to the extrema according to flexible.

flexible

When TRUE values of n outside the acceptable range are accepted and replaced with first or last positions.

Details

Definition of the positions is flexible (outside positions is interpreted as minimum / maximum positions) or not, according to flexible.

Value

(text3ij2n) The resulting ranks associated to the rows of ij.
(text3n2ij) The resulting positions associated to n. When length(n)==1 it is a numeric(2) if not a matrix with two columns.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
 
  ## 
  ## text3ij2n 
  aa <- c(paste(letters,collapse=""),paste(LETTERS,collapse=""),paste(0:9,collapse="")); 
  text3ij2n(c(1,3),aa); 
  text3ij2n(c(2,1),aa); 
  text3ij2n(rbind(c(1,3),c(2,1)),aa); 
  ## 
  ## text3n2ij 
  aa <- c(paste(letters,collapse=""),paste(LETTERS,collapse=""),paste(0:9,collapse="")); 
  text3n2ij(text3ij2n(c(1,3),aa),aa); 
  text3n2ij(text3ij2n(c(2,1),aa),aa); 
  text3n2ij(text3ij2n(rbind(c(1,3),c(2,1)),aa),aa); 

rbsa documentation built on May 2, 2019, 6:07 p.m.