readthat (version 0.0.1)

readl: Read lines from file/webpage

Description

Returns lines of text/source from file or URL

Usage

readl(.x, first = 1, last = -1)

Arguments

.x

Path to file or URL

first

The first (starting) line number in which reading should start (inclusive). Defaults to 1.

last

The last (ending) line number in which reading should end (inclusive). To ensure the reading of all possible lines, set this value to less than 1 (0 or -1). Defaults to -1.

Value

A vector of lines read from input

See Also

Other read: read

Examples

Run this code
# NOT RUN {
## create a temp file containing multiple lines of text
tmp <- tempfile()
cat("TITLE", "", "By", "", "Some more text here", "",
  "last line", sep = "\n", file = tmp)

## read all lines of tmp
readl(tmp)

## read first three lines
readl(tmp, 1, 3)

## read lines 3-5
readl(tmp, 3, 5)

## cleanup
unlink(tmp)

# }

Run the code above in your browser using DataCamp Workspace