Description Usage Arguments Details Value Author(s) Examples
strip blank characters from the ends of a character string or skip blank lines (or lines with a particular pattern) in a file
1 2 3 | strip.blanks(str)
skip.blank.lines(con)
skip.pattern.lines(con,pattern,blank.ok=TRUE)
|
str |
a character vector |
con |
an open connection |
pattern |
a regular expression pattern |
blank.ok |
skip blank lines as well as lines containing patterns? |
skip.blank.lines()
and skip.pattern.lines()
read lines from a file until the first
non-blank line or the first line without a specified pattern
then pushes that line back
A character vector with blanks removed (for strip.blanks
)
or the number of lines skipped (skip.blank.lines
or
skip.pattern.lines
)
Ben Bolker
1 2 3 4 5 6 7 8 9 10 | strip.blanks(c(" a ","b"," c "))
tfn = tempfile("test")
tfile = file(tfn,open="w")
writeLines(c(""," ","abc"),tfile)
close(tfile)
tfile=file(tfn,open="r")
skip.blank.lines(tfile)
readLines(tfile)
close(tfile)
unlink(tfn)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.