Skip to content

Instantly share code, notes, and snippets.

View daroczig's full-sized avatar

Gergely Daróczi daroczig

View GitHub Profile
@daroczig
daroczig / .emacs
Created April 20, 2012 14:39
Building and (re)loading packages with a keypress in Emacs
(defun ess-build-and-load-package ()
"Builds R pkg in current project and (re)loads it in R session."
(interactive)
(setq curbuf (current-buffer))
(setq w1 (selected-window))
(setq w1name (buffer-name))
(setq tmpbuf (get-buffer-create "*pkg build*"))
(setq w2 (split-window-horizontally))
(shell-command (format "~/.emacs.d/build-R-pkg.sh %s" eproject-root) tmpbuf )
(ess-command (format "pkg.path <- \"%s\";pkg.name <- readLines(file.path(pkg.path, 'DESCRIPTION'));pkg.name <- strsplit(pkg.name[grepl('Package: ', pkg.name)], ' ')[[1]][2];pkg.ns <- paste0('package:', pkg.name);if (!is.na(match(pkg.ns, search()))){detach(pkg.ns, character.only = TRUE)};library(pkg.name, character.only = TRUE, unload = TRUE)\n" eproject-root))
@daroczig
daroczig / buildpkg.R
Created April 17, 2012 14:41 — forked from aL3xa/buildpkg.R
Build, Check, Install and (Re)Load R Package
b <- function(path = "package/", ...){
require(devtools)
require(roxygen2)
pkg <- as.package(path) # package pointer
## update documentation
message("Updating documentation...")
roxygenise(path, ...)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="pandoc" />
<title></title>
</head>
<body>
<p>List:</p>
<ul>