Programmation R défensive
Dr. Colin Gillespie
Jumping Rivers
Comme un correcteur orthographique
Pour utiliser lintr
lint()Supposons que j'ai le code suivant
my_bad<-function(x, y) {
x+y
}
enregistré dans le fichier code.R.
lintr::lint("code.R") signale deux problèmesmy_bad<-function(x,y) {
x+y
}
r[[1]]
tmp.R:1:7: style: Put spaces around all infix operators.
my_bad<-function(x,y) {
~^~~
my_bad <- function()
my_bad<-function(x,y) {
x+y
}
r[[3]]
tmp.R:2:4: style: Put spaces around all infix operators.
x+y
~^~
x + y
Programmation R défensive