Skip to content

Instantly share code, notes, and snippets.

View nathan-russell's full-sized avatar

Nathan Russell nathan-russell

View GitHub Profile
df1 <- structure(list(numWeek = structure(c(10959,
10966, 10973, 10980, 10987, 10994, 11001, 11008, 11015, 11022,
11029, 11036), class = "Date")), .Names = "numWeek", row.names = c(NA,
-12L), class = "data.frame")
df2 <- structure(list(effective = c(1, 1, 1, 1, 1, 1, 4, 3, 4, 5, 8,
4), numWeek = c("2000-01-03", "2000-02-14", "2000-02-28", "2000-03-13",
"2000-04-10", "2000-05-01", "2000-05-08", "2000-05-15", "2000-05-22",
"2000-05-29", "2000-06-05", "2000-06-12")), .Names = c("effective",
"numWeek"), row.names = c(NA, 12L), class = "data.frame")
diff --git a/inst/include/dplyr/Collecter.h b/inst/include/dplyr/Collecter.h
index a5ecd45..cd45d97 100644
--- a/inst/include/dplyr/Collecter.h
+++ b/inst/include/dplyr/Collecter.h
@@ -93,7 +93,7 @@ public:
return RTYPE == TYPEOF(x) || all_logical_na(x, TYPEOF(x));
}
- bool can_promote(SEXP x) const {
+ bool can_promote(SEXP /*x*/) const {
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
CharacterVector ModifyString(CharacterVector x)
{
String ref = x[0];
ref = "Modified";
return x;
}
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
IntegerVector rcpp_build(int n)
{
IntegerVector res;
for (int i = 0; i < n; i++) {
res.push_back(i);
}
~/opt/R-devel$ ag '_R_CHECK' | sed -re 's/.*(_R_CHECK[a-zA-Z0-9_]+).*/\1/g' | sort | uniq
# _R_CHECK_
# _R_CHECK_ALL_NON_ISO_C_
# _R_CHECK_ALWAYS_LOG_VIGNETTE_OUTPUT_
# _R_CHECK_ASCII_CODE_
# _R_CHECK_ASCII_DATA_
# _R_CHECK_CLEAN_VIGN_TEST_
# _R_CHECK_CODE_ASSIGN_TO_GLOBALENV_
# _R_CHECK_CODE_ATTACH_
# _R_CHECK_CODE_DATA_INTO_GLOBALENV_
library(tibble)
library(data.table)
library(dplyr)
library(hashmap)
library(microbenchmark)
set.seed(123)
nkeys <- 10 ** 7
keylen <- 8
df1 <- data.table::data.table(
Country = c("Germany", "France"),
y = rnorm(10),
x = rnorm(10)
)
# Option 1: non-environment object + special assignment operator
failed.countries <- character()
for (country in c("France","USA", "Germany")) {
tryCatch({
f <- function(x) if (x == "France") stop("error") else cat("success\n")
for (country in c("France","USA", "Germany")) {
tryCatch({
f(country)
}, error = function(e) {
cat("failed on ", country, "\n")
})
}
# failed on France
# success
template <int RTYPE>
class MyNumVec {
public:
typedef Rcpp::Vector<RTYPE> vec_t;
typedef typename Rcpp::traits::storage_type<RTYPE>::type storage_t;
private:
const vec_t& x;
public:
// src/hinterface.cpp
#include "hinterface.h"
// [[Rcpp::export]]
int call_bla_in_hinterface()
{ return hinterface::bla().first; }
// [[Rcpp::export("bla")]]
void bla_()
{