Skip to content

Instantly share code, notes, and snippets.

View philipp-baumann's full-sized avatar
:atom:
Sensing the environment. WhoeverWhatever-Cares.

Philipp Baumann philipp-baumann

:atom:
Sensing the environment. WhoeverWhatever-Cares.
View GitHub Profile
@philipp-baumann
philipp-baumann / snv-benchmark.R
Last active August 22, 2023 20:11
snv-benchmark.R
snv_impl_base <- function(X) {
X <- as.matrix(X)
X <- sweep(X, 1L, rowMeans(X, na.rm = TRUE), `-`)
X_sc <- sweep(X, 1L, apply(X, 1L, sd, na.rm = TRUE), `/`)
return(X_sc)
}
snv_impl_base_mstats <- function(X) {
X <- as.matrix(X)
X <- sweep(X, 1L, matrixStats::rowMeans2(X, na.rm = TRUE), `-`)
@philipp-baumann
philipp-baumann / test-with_nix.R
Last active January 6, 2024 19:09
Testing new {rix} with_nix()
# install_github("b-rodrigues/rix", ref = "71-with-nix")
library("rix")
library("dplyr")
library("data.table")
# fusen::load_flat_functions(flat_file = "dev/build_envs.Rmd")
# fusen::load_flat_functions(flat_file = "dev/get_os.Rmd")
library("rix")
# This file was generated by the {rix} R package v0.4.1 on 2024-01-06
# with following call:
# >rix(r_ver = "63143ac2c9186be6d9da6035fa22620018c85932",
# > r_pkgs = c("dplyr",
# > "data.table"),
# > overwrite = TRUE)
# It uses nixpkgs' revision 63143ac2c9186be6d9da6035fa22620018c85932 for reproducibility purposes
# which will install R version latest
# Report any issues to https://github.com/b-rodrigues/rix
let
@philipp-baumann
philipp-baumann / rix-rstudio-aarch-darwin_logs.txt
Created February 27, 2024 19:21
rix-rstudio-aarch-darwin_logs.txt
CMake Warning:
Manually-specified variables were not used by the project:
BUILD_TESTING
CMAKE_EXPORT_NO_PACKAGE_REGISTRY
CMAKE_POLICY_DEFAULT_CMP0025
QT_QMAKE_EXECUTABLE
-- Build files have been written to: /tmp/nix-build-RStudio-2023.09.0+463.drv-1/source/build
@philipp-baumann
philipp-baumann / get_nix_arrow_env.R
Created April 21, 2024 17:23
Get nix environment with R and arrow
if (!require("rix")) {
if (!require("remotes") install.packages("remotes")
remotes::install_github("b-rodrigues/rix")
}
library("rix")
# make sure that only nix library paths in /nix/... are used to load R packages
rix_init()
# define `default.nix` in reproducible manner (will ping nixpkgs revision on GitHub)
rix(