Skip to content

Instantly share code, notes, and snippets.

View franzbischoff's full-sized avatar
I were here

Francisco Bischoff franzbischoff

I were here
View GitHub Profile
@franzbischoff
franzbischoff / fft.cpp
Created September 19, 2020 22:39
FFT thread-safe
/*
R : A Computer Language for Statistical Data Analysis
Copyright (C) 1998--2019 The R Core Team
Copyright (C) 1995, 1996, 1997 Robert Gentleman and Ross Ihaka
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
#Load Libraries
library(foreach)
library(utils)
library(iterators)
library(doParallel)
#Choose number of iterations
n <- 1000
#Progress combine function
@franzbischoff
franzbischoff / arguments.R
Last active July 9, 2020 23:32
How to verify if arguments were called, the difficult way
myfunction <- function (a, b, c, ...)
{
p <- list()
# use formals to get the arguments from a function.
# use sys.function() to get the own function. if you return sys.function() you return itself
formal.args <- formals(sys.function())
formal.args[["..."]] <- NULL # this is not needed, but here you can remove the "..." argument
for (arg in names(formal.args)) {
@franzbischoff
franzbischoff / plot_dependencies.R
Last active March 5, 2020 23:54 — forked from crsh/plot_dependencies.R
Plots the network of package dependencies
#' Plot network of package dependencies
#'
#' @param pkg package description, can be path or package name. See \code{\link[devtools]{as.package}} for
#' more information.
#'
#' @details The resulting plot visualizes the network of package dependencies. If you are trying to cut down
#' on package dependencies look for big red dots that represent a lot of upstream but few downstream
#' dependencies.
#' @import ggplot2
#' @export
@franzbischoff
franzbischoff / check_buildignore.R
Created March 4, 2020 21:19
Check which files are ignored and which will stay in your R package using .Rbuildignore
check_buildignore <- function() {
patterns <- readLines(".Rbuildignore")
hits <- list()
for (pat in patterns) {
hit <- dir(
full.names = FALSE, recursive = TRUE,
all.files = TRUE, include.dirs = TRUE, no.. = TRUE
)[grepl(
pat,
dir(
@franzbischoff
franzbischoff / tsmp-examples.ipynb
Last active March 22, 2024 14:14
tsmp examples.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.