使用ESS / R重构R代码 [英] Refactoring R code using ESS/R
问题描述
我想知道是否可以在ESS中重构R代码。在Emacs中使用搜索和替换似乎不是一个很好的选择。
I would like to know if it is possible to refactor R code in ESS. Using search and replace in Emacs does not seem to be a good alternative to it.
推荐答案
ESS本身不提供任何设施重构。相反,您可以使用emacs功能。
ESS itself does not provide any facilities for refactoring. Instead you can use emacs functionality.
下面是一个例子,说明如何在项目目录中的所有打开的R文件中替换以xxx开头并以yyy结尾的所有单词zzzzzz
Here is an example of how to replace all words starting with "xxx" and ending with "yyy" with "zzzzzz" in all your open R files in your project directory.
-
Cx d (输入dired)
%mr $ (标记所有以R或r结尾的文件)
% m r$ (mark all files ending in R or r)
这里是一个完整的教程如何在多个文件中进行搜索替换。
以及如何使用 ibuffer
保存所有修改的缓冲区。
Here is a complete tutorial of how to search-replace in multiple files.
and also how to save all modified buffers with ibuffer
.
这篇关于使用ESS / R重构R代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!