-
Dropping attributes
matrix[, 1, drop=FALSE]
-
Autocompletion for thee but not for me
x <- list(foo_bar = 1) x$foo <- x$foo + 1 x$foo != x$foo_bar
-
Remember to useDynLib and to never ever Rbuildignore .o/.so or you'll get function not available problems. https://stackoverflow.com/questions/12976036/how-to-use-usedynlib-correctly-in-an-r-package-namespace-file Also somehow gitignoring src/RcppExports.cpp causes many bad things to happen.
-
geom_density is for area, use stat_density for a line: tidyverse/ggplot2#1523 (comment)
library("ggplot2") ggplot(mtcars) + aes(mpg) + geom_density(alpha = 0.25, fill = "grey80") ## vs ggplot(mtcars) + aes(mpg) + stat_density(alpha = 0.25, geom = "line") # position = "identity" for groups
-
index recycling????
x <- seq(10) x[c(TRUE, FALSE)] # [1] 1 3 5 7 9 x[c(TRUE, FALSE, TRUE)] # [1] 1 3 4 6 7 9 10
"lol" said the scorpion. "lmao"
rep(TRUE, 10) & c(TRUE, FALSE, FALSE) # Warning message: # In rep(TRUE, 10) & c(TRUE, FALSE, FALSE) : # longer object length is not a multiple of shorter object length 1:10 + c(TRUE, FALSE, FALSE) # Warning message: # In 1:10 + c(TRUE, FALSE, FALSE) : # longer object length is not a multiple of shorter object length
-
Initialise memory, either using assignment, a constructor that initialises memory, or a function after the fact. Especially member variables!
-
Don't use floating point values as indicator variables (or as integers generally). These can be unstable!
-
Conda with snakemake does many funny things.
-
If using it with shell prefix you have to set -eu, source conda.sh, then set +eu, then activate the env.
set -eu if [ -f ~/miniconda3/etc/profile.d/conda.sh ]; then source ~/miniconda3/etc/profile.d/conda.sh fi set +eu
-
There may also be some funniness with the environment's setup scripts and unbound variables. Bash strict mode is a thing
:
in a filename is parsed as a new target! Leads toMakefile:[linenumber]: *** multiple target patterns. Stop.