如何配置RStudio允许WhiteSmith缩进?

时间:2020-09-04 05:19:49

标签: r rstudio indentation

有关此缩进模式的详细信息,请参见:http://www.activeclickweb.com/whitesmiths/index.htmlhttps://en.wikipedia.org/wiki/Indentation_style#Whitesmiths_style

使用R,这是使用这种缩进样式的示例基本功能:

# this is "not" recursive at the moment ...
createDir = function (folder)
  {
  ifelse(!dir.exists(folder), dir.create(folder), "Folder exists already")
  }

以下是使用相同样式的函数内的switch语句:

buildX = function(n,method)
  {
  switch(method,
         "rnorm-0-1" = rnorm(n,0,1),
         "rgama-1-0.5" = rgamma(n,1,1/2),
         rnorm(n,0,1) # default case of switch
        );
  }

这里是另一个功能,总结一下例子:

buildY = function(resp, n, unif, myQ)
  {
  Y = numeric(n);
  for (i in 1:n)
    {
    Y[i] = mapY(i, unif, myQ, resp);
    }
  Y;
  }

如何配置RStudio使用这种缩进样式?复制粘贴后可以使用吗?

像记事本++一样,可以更容易地突出显示两个大括号的功能的奖励吗?我可以单击打开/关闭支架的右侧/左侧,它会突出显示,甚至创建一条垂直线连接支架...

brace highlighting

0 个答案:

没有答案
相关问题