Learn R Programming

this.path (version 2.5.0)

FILE: Macros in Package 'this.path'

Description

FILE() and LINE() are intended to be used in a similar manner to the macros __FILE__ and __LINE__ in C. They are useful for generating a diagnostic message / / warning / / error to about the status of the program.

Usage

FILE()
LINE()

Arguments

Examples

Run this code
FILE.R <- tempfile(fileext = ".R")
writeLines("fun <- function ()
{
    message(sprintf('invalid value %d at %s, line %d',
        -1, FILE(), LINE()))
}
", FILE.R)
source(FILE.R, verbose = FALSE, keep.source = TRUE)
fun()
unlink(FILE.R)

Run the code above in your browser using DataLab