Learn R Programming

berryFunctions (version 1.16.0)

funSource: Source code of a function

Description

open source code of a function in a loaded or specified package on github.com/cran or github.com/wch/r-source

Usage

funSource(x, character.only = is.character(x), trydirect = TRUE)

Arguments

x

function name, with or without quotation marks

character.only

If TRUE, look for SomeFun instead of MyFun if MyFun <- "SomeFun". DEFAULT: is.character(x)

trydirect

If TRUE, try direct urls to files x.R and x.r. DEFAULT: TRUE

Value

links that are also opened with browseURL

See Also

https://github.com/brry/rskey to add this as a keyboard shortcut

Examples

Run this code
# NOT RUN {
 ## browser windows should not be openend in CRAN checks
library("berryFunctions")
funSource(colPoints)
funSource("head")
funSource("require", trydirect=FALSE)

funSource(earthDist)
funSource(OSMscale::earthDist)
funSource("OSMscale::earthDist")
# }
# NOT RUN {
# }
# NOT RUN {
 # developmental testing
require(plotrix); require(scales)
funSource(rescale

tail <- function(...) stop("This is a dummy function. Type: rm(tail)")
funSource("tail")
rm(tail)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab