write_fun: Write function to Rprofile.site

Description Usage Arguments Examples

View source: R/utils.R

Description

This will make the function globally available to all exercises.

Usage

1
write_fun(fun, file = "/etc/R/Rprofile.site")

Arguments

fun

function to write to Rprofile.site

file

the file to write the function to

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
 tf <- tempfile(fileext = '.R')
 add <- function(x, y){
   x + y
 }
 write_fun(add, file = tf)
 cat(paste(readLines(tf, warn = FALSE), collapse = '\n'))

## End(Not run)

datacamp/rexplorables documentation built on June 6, 2021, 4:12 p.m.