Description Usage Arguments Details Value See Also Examples
Read file or text string using a regular expression to separate fields.
1 |
file |
See |
pattern |
A regular expression. |
perl |
logical. If |
text |
See |
sep |
This should be a character that does not appear in any field. It is used for holding an intermediate form of the text. |
fileEncoding |
See |
... |
Further arguments passed to |
The parenthesized portions of the regular expression are extracted as fields.
A data.frame.
See strapplyc
, read.table
.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 3 space-separated fields. The first field may have embedded spaces.
Lines <- "this is the first field 1 2
more text 3 4
"
pat <- "^(.*) +(\\S+) +(\\S+)$"
read.pattern(text = Lines, pattern = pat, as.is = TRUE)
# 3 space-separated fields. The last field may have embedded spaces.
Lines2 <- "1 2 this is the first field
3 4 more text
"
pat2 <- "^(\\S+) +(\\S+) +(.*)$"
read.pattern(text = Lines2, pattern = pat2, as.is = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.