The indentation for R code after using Edit -> Line -> Reindent is not like I expect. Expected one is like in RStudio where closing brackets are more to the left when using “lapply()”. The text after “if()” without “{}” should be indented. The closing brackets from function “foo” should be to the left. How can I fix this?
Here is how the code looks in Sublime 3. Function “loo” starts after tab which is wrong.
foo <- function(a){
if(a == 1)
a <- 2
if(a == 2){
a <- 3
}else{
if(a > 10)
a <- 10
}
return(a)
}
loo <- lapply(list, function(x){
if(sum(x) > 10)
return(NULL)
})
Here, in RStudio:
foo <- function(a){
if(a == 1)
a <- 2
if(a == 2){
a <- 3
}else{
if(a > 10)
a <- 10
}
return(a)
}
loo <- lapply(list, function(x){
if(sum(x) > 10)
return(NULL)
})
Thank you for any hints!