Description Usage Arguments Details Value Examples
from a text,
gives back a list of texts according to the delimitations
proposed into where; typically where can be deduced from
output of places4text6tags. Empty lines can be removed.
The idea is from a text comprising several lines, to get pieces of it
after eliminating the delimitating tags; when the tags have already been
identified since they are indicated through their positions with
the argument where. A delimitation is given in each row of where,
so according to the values of addbeg and addend the maximum
length of the returned list is nrow(where)-1, nrow(where)
or nrow(where)+1.
1 2 3 |
texts4text(text,where,
addbeg=TRUE,addend=TRUE,rmeli=TRUE)
|
text |
A named character vector containing the text (a component, a line). |
where |
A two or three column matrix (when a two column matrix, the second column is first duplicated as third column and substracted with 1 to generate a simple splitting at this point). The first column gives the line number; the second column, the first character of the position (excluded in the previous text component); the third column, the last character of the position (excluded in the next text component). Overlapping of the extraction is not admitted so the difference between the second and third column can be greater than one. |
addbeg |
Add (or not) what is before the first position? |
addend |
Add (or not) what is after the last position? |
rmeli |
Must empty lines of the found texts ("") must be eliminated? |
When nrow(where)==0 an empty list is returned without
warning.
The component number i of the resulting list, is the portion of text
in between the two positions indicated by rows i and i+1 of
where of course, it can comprise several lines, that is be a
character vector.
The two positions defining a delimitation are included (i.e. second and third columns
of the where matrix) in the tag. Nevertheless a split can be obtained at
position 7 in row 3 by the following row in matrix where:
c(3,7,6).
When delimitations are not consistent, a fatal error is issued.
A list of characters each corresponding to an extracted text.
1 2 3 4 5 6 7 8 9 10 11 12 |
uu <- paste(letters,collapse=""); UU <- toupper(uu);
ww <- matrix(c(1,2,2,1,12,13,2,5,10),ncol=3,byrow=TRUE);
texts4text(c(uu),ww[1,,drop=FALSE]);
texts4text(c(uu),c(1,7,6));
texts4text(c(uu),ww[1:2,]);
texts4text(c(uu,UU),ww);
texts4text(c(uu,"",UU),ww);
texts4text(c(uu,"",UU),ww,rmeli=FALSE);
texts4text(c(uu),ww);
texts4text(c(uu),ww[1,,drop=FALSE],addbeg=FALSE);
texts4text(c(uu),ww[1,,drop=FALSE],addbeg=FALSE,addend=FALSE);
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.