Skip to content

Instantly share code, notes, and snippets.

View kenahoo's full-sized avatar

Ken Williams kenahoo

View GitHub Profile
#include <Rcpp.h>
using namespace Rcpp;
//' Find "detectable change points" in a numeric data frame
//'
//' If you have a huge data frame that you want to do a line-plot of, this
//' function can help down-sample the data to remove consecutive redundancies
//' that would be undetectable in a plot whose resolution is higher than
//' \code{thresh}. It's similar *in spirit* to something like
//' \code{x <- diff(as.matrix(df)); which(apply(x, 1, function(r) any(r>thresh)))},
This is pdfTeX, Version 3.1415926-2.3-1.40.12 (MiKTeX 2.9) (preloaded format=latex 2012.3.25) 18 SEP 2013 13:21
entering extended mode
**c:/Users/KWILLI?1/AppData/Local/Temp/orgtex6488Qq2.tex
(c:/Users/KWILLI~1/AppData/Local/Temp/orgtex6488Qq2.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, afrikaans, ancientgreek, ar
abic, armenian, assamese, basque, bengali, bokmal, bulgarian, catalan, coptic,
croatian, czech, danish, dutch, esperanto, estonian, farsi, finnish, french, ga
lician, german, german-x-2009-06-19, greek, gujarati, hindi, hungarian, iceland
ic, indonesian, interlingua, irish, italian, kannada, kurmanji, lao, latin, lat
@kenahoo
kenahoo / Rcpp-DataFrame.R
Last active December 13, 2015 23:28
Rcpp for DataFrame access
library(Rcpp)
cppFunction('
int countSteps (DataFrame df, double thresh=0.001) {
int out = 0;
if(df.nrows()==0) return out;
int last_i = 0;
out++;
{
"Append RAqua libs to R_LIBS" = NO;
"ApplicationCrashedAfterRelaunch" = 0;
"auto.close.parens" = YES;
"Background Color" = <040b7374 7265616d 74797065 6481e803 84014084 8484074e 53436f6c 6f720084 84084e53 4f626a65 63740085 84016301 84046666 66660101 010186>;
"Cleanup history entries" = YES;
"Console Font Size" = 10;
"default.CRAN.mirror.save.dontask" = NO;
"default.CRAN.mirror.URL" = "http://streaming.stat.iastate.edu/CRAN";
"Disable R signal handlers" = NO;