Learn R Programming

assertive (version 0.2-6)

as.character.file: Convert file connections to strings

Description

as.character method for file connections.

Usage

## S3 method for class 'file':
as.character(x, ...)

Arguments

x
A file connection.
...
Not currently used.

Value

  • A string containing the target location of the file connection.

See Also

file, summary.connection, as.character

Examples

Run this code
rprofile <- file.path(R.home("etc"), "Rprofile.site")
fcon <- file(rprofile)
assert_all_are_true(identical(as.character(fcon), rprofile))
close(fcon)

Run the code above in your browser using DataLab