Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

here

Here Documents


Description

Read lines and convert into appropriate vector or data frame.

Usage

here(s, drop = TRUE, guess.type = TRUE, sep = NULL, header = TRUE,
     stringsAsFactors = FALSE, trim = TRUE, ...)

Arguments

s

a string

drop

logical: drop empty first and last element

guess.type

logical

sep

NULL or character

header

logical

stringsAsFactors

logical

trim

logical: trim whitespace?

...

named arguments to be passed to read.table

Details

Experimental. (Notably, the function's name may change.)

The function reads a (typically multi-line) string and treats each line as one element of a vector or, if sep is specified, a data.frame.

If sep is not specified, here calls type.convert on the input s.

If sep is specified, the input s is fed to read.table. Additional arguments may be passed through ....

Value

a vector or, if sep is specified, a data.frame

Author(s)

Enrico Schumann

References

(note that R supports multi-line strings, so in a way it has built-in support for here documents as defined on that website)

See Also

Examples

## numbers
here("
1
2
3
4
")

## character
here("
Al
Bob
Carl
David
")

## data frame
here("
letter, number
     x,      1
     y,      2
     z,      3",
sep = ",")

textutils

Utilities for Handling Strings and Text

v0.2-1
GPL-3
Authors
Enrico Schumann [aut, cre] (<https://orcid.org/0000-0001-7601-6576>)
Initial release
2021-04-01

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.