Skip to content

Commit

Permalink
Removing repetitive declarations.
Browse files Browse the repository at this point in the history
  • Loading branch information
NicChr committed Apr 17, 2024
1 parent f71325a commit 7811325
Show file tree
Hide file tree
Showing 12 changed files with 5 additions and 20 deletions.
2 changes: 1 addition & 1 deletion R/lag.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#' @description
#' Fast lags and leads
#'
#' @param x A vector.
#' @param x A vector or data frame.
#' @param n Number of lags. Negative values are accepted.
#' @param fill Value used to fill first n values. Default is `NA`.
#' @param set Should x be updated by reference? If `TRUE` no copy is made and
Expand Down
2 changes: 1 addition & 1 deletion man/lag_.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions src/attrs.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include "cheapr_cpp.h"
#include <cpp11.hpp>
#include <Rinternals.h>

// Adding and removing attributes in-place
// There is a check to ensure that attributes are copied when they are the same
Expand Down
3 changes: 3 additions & 0 deletions src/cheapr_cpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
#ifndef cheapr_cpp_funs
#define cheapr_cpp_funs

#ifndef R_NO_REMAP
#define R_NO_REMAP
#endif

#define VECTOR_PTR(x) ((SEXP *) DATAPTR(x))
#define VECTOR_PTR_RO(x) ((const SEXP*) DATAPTR_RO(x))

Expand Down
2 changes: 0 additions & 2 deletions src/gcd.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include "cheapr_cpp.h"
#include <cpp11.hpp>
#include <Rinternals.h>

[[cpp11::register]]
double cpp_gcd2(double x, double y, double tol, bool na_rm){
Expand Down
2 changes: 0 additions & 2 deletions src/lag.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include "cheapr_cpp.h"
#include <cpp11.hpp>
#include <Rinternals.h>

[[cpp11::register]]
SEXP cpp_lag(SEXP x, int k, SEXP fill, bool set, bool recursive) {
Expand Down
2 changes: 0 additions & 2 deletions src/nas.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include "cheapr_cpp.h"
#include <cpp11.hpp>
#include <Rinternals.h>

R_xlen_t na_count(SEXP x, bool recursive){
R_xlen_t n = Rf_xlength(x);
Expand Down
2 changes: 0 additions & 2 deletions src/sequences.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include "cheapr_cpp.h"
#include <cpp11.hpp>
#include <Rinternals.h>

double r_sum(SEXP x, bool na_rm = false){
cpp11::function base_sum = cpp11::package("base")["sum"];
Expand Down
2 changes: 0 additions & 2 deletions src/set_math.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include "cheapr_cpp.h"
#include <cpp11.hpp>
#include <Rinternals.h>

// Basic math operations by reference
// All NA and NaN values are ignored
Expand Down
2 changes: 0 additions & 2 deletions src/sset.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include "cheapr_cpp.h"
#include <cpp11.hpp>
#include <Rinternals.h>
// #include <vector>
// using namespace cpp11;

Expand Down
2 changes: 0 additions & 2 deletions src/utils.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include "cheapr_cpp.h"
#include <cpp11.hpp>
#include <Rinternals.h>

int int_div(int x, int y){
return x / y;
Expand Down
2 changes: 0 additions & 2 deletions src/which.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#include "cheapr_cpp.h"
#include <cpp11.hpp>
#include <Rinternals.h>

// A more memory-efficient which()
// Author: Nick Christofides
Expand Down

0 comments on commit 7811325

Please sign in to comment.