This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' @export | |
justgage <- function(title, value, min, max, | |
label = NULL, width = 200, height = 160) { | |
structure(class = "justgage", list( | |
title = title, | |
label = label, | |
value = value, | |
min = min, | |
max = max, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Untitled" | |
output: | |
revealjs_presentation: | |
theme: serif | |
self_contained: false | |
incremental: true | |
transition: none | |
pandoc_args: ["--css", "style.css"] | |
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Dygraphs in R Markdown" | |
output: html_document | |
runtime: shiny | |
--- | |
```{r} | |
library(dygraphs) | |
hw <- HoltWinters(ldeaths) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Rcpp.h> | |
using namespace Rcpp; | |
using namespace Rcpp; | |
class Uniform { | |
public: | |
Uniform(double min_, double max_) : min(min_), max(max_) {} | |
NumericVector draw(int n) const { | |
RNGScope scope; | |
return runif( n, min, max ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Rcpp.h> | |
using namespace Rcpp; | |
// [[Rcpp::depends(BH)]] | |
#include <boost/bind.hpp> | |
#include <boost/function.hpp> | |
typedef boost::function<int(int,int)> Combiner; | |
int add(int x, int y) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Rcpp.h> | |
using namespace Rcpp; | |
// [[Rcpp::export]] | |
CharacterVector asUTF8(CharacterVector x) { | |
const void *vmax = vmaxget(); | |
CharacterVector xUTF8(x.length()); | |
for (int i = 0; i<x.length(); i++) { | |
const char* utf8 = Rf_translateCharUTF8(x[i]); | |
xUTF8[i] = Rf_mkCharCE(utf8, CE_UTF8); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Rcpp.h> | |
using namespace Rcpp; | |
// [[Rcpp::export]] | |
int fibonacciCpp(const int x) { | |
if (x == 0) return(0); | |
if (x == 1) return(1); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// [[Rcpp::linking_to(RcppArmadillo)]] | |
#include <RcppArmadillo.h> | |
using namespace Rcpp; | |
// [[Rcpp::export]] | |
List fastLmCpp(NumericVector yr, NumericMatrix Xr) { | |
int n = Xr.nrow(), k = Xr.ncol(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```{r engine='Rcpp'} | |
int fibonacci(const int x) { | |
if (x == 0) return(0); | |
if (x == 1) return(1); | |
return (fibonacci(x - 1)) + fibonacci(x - 2); | |
} | |
``` | |
```{r engine='Rcpp', Rcpp.plugin='RcppArmadillo'} | |
List fastLm(NumericVector yr, NumericMatrix Xr) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Setup the build environment based on the specified dependencies. Returns an | |
# opaque object that can be passed to .restoreEnvironment to reverse whatever | |
# changes that were made | |
.setupBuildEnvironment <- function(depends) { | |
# discover dependencies | |
buildEnv <- list() | |
linkingToPackages <- c("Rcpp") | |
for (package in depends) { |
OlderNewer