Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to automatically align function arguments?

Tags:

rstudio

In RStudio is there a way to automatically align the equal signs in function arguments?

Similar to the following:

objective         = obj,
eta               = params$eta[i],
gamma             = params$gamma[i],
max_depth         = params$max_depth[i],
colsample_bytree  = params$colsample_bytree[i],
colsample_bylevel = params$colsample_bylevel[i],
lambda            = params$lambda[i],
alpha             = params$alpha[i],
subsample         = params$subsample[i])

I find this much easier to read. If it is not available in RStudio is there a different editor which has this capability?

like image 297
rwdvc Avatar asked Sep 13 '25 09:09

rwdvc


1 Answers

Another option is {remedy}, which is also on CRAN.

That package include addins for aligning equal signs = and assignments <-, plus other addins for working with markdown documents.

like image 79
jpiversen Avatar answered Sep 17 '25 02:09

jpiversen