boB Rudis
6 years ago
4 changed files with 36 additions and 0 deletions
@ -0,0 +1,19 @@ |
|||||
|
#' Clean the environment and run the active script |
||||
|
#' |
||||
|
#' @export |
||||
|
cleanAndGo <- function() { |
||||
|
|
||||
|
ctx <- rstudioapi::getActiveDocumentContext() |
||||
|
|
||||
|
if (!is.null(ctx)) { |
||||
|
|
||||
|
do.call(rm, as.list(ls(all.names = TRUE, envir = .GlobalEnv)), envir = .GlobalEnv) |
||||
|
|
||||
|
tf <- tempfile(fileext = ".R") |
||||
|
writeLines(ctx$contents, con = tf) |
||||
|
|
||||
|
source(tf, local = FALSE) |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
% Generated by roxygen2: do not edit by hand |
||||
|
% Please edit documentation in R/cleanAndGo.R |
||||
|
\name{cleanAndGo} |
||||
|
\alias{cleanAndGo} |
||||
|
\title{Clean the environment and run the active script} |
||||
|
\usage{ |
||||
|
cleanAndGo() |
||||
|
} |
||||
|
\description{ |
||||
|
Clean the environment and run the active script |
||||
|
} |
Loading…
Reference in new issue