Learn R Programming

this.path (version 2.5.0)

print.ThisPathDocumentContext: Printing "ThisPathDocumentContext" Objects

Description

Print a "ThisPathDocumentContext" object.

Usage

# S3 method for ThisPathDocumentContext
print(x, ..., quote = TRUE)

# S3 method for ThisPathDocumentContext format(x, ...)

# S3 method for ThisPathDocumentContext as.character(x, ...)

Value

for print.ThisPathDocumentContext(), x invisibly.

for format.ThisPathDocumentContext(), a character vector of lines.

for as.character.ThisPathDocumentContext(), a character string of concatenated lines.

Arguments

x

object of class "ThisPathDocumentContext".

...

unused.

quote

logical, indicating whether or not strings should be printed with surrounding quotes.

Details

An object of class "ThisPathDocumentContext" is generated upon calling set.sys.path(), wrap.source(), sys.path(), env.path(), or src.path(), and by extension this.path(). It contains information about the path of the executing / / current script.

These objects are not usually user-visible.

Examples

Run this code
fun <- function (file)
{
    set.sys.path(file, Function = "fun")
    `.this.path::document.context`
}


fun()


fun("clipboard")


fun(paste0("https://raw.githubusercontent.com/ArcadeAntics/",
           "this.path/main/tests/sys-path-with-urls.R"))


FILE.R <- tempfile(fileext = ".R"); file.create(FILE.R)

x <- fun(FILE.R)
print(x)
print(x, quote = FALSE)
format(x)
as.character(x)

unlink(FILE.R)

Run the code above in your browser using DataLab