在 R 中:每次出现在脚本中时查找并替换变量名称的一部分

In R: Finding and Replacing part of a variable's name every time it appears in the script

我是运行数据集中许多变量的同一段代码。例如:

xPart1 <- d$xPart1

xPart1complete <- rbind(xPart1, A)

我想知道是否有办法用 yPart.

替换 xPart 的每个实例(即使它只部分出现在变量名中)

提前感谢您的帮助,

西姆兰

如果您使用的是 RStudio,那么您可以按 ctrl+F,脚本顶部会出现一个栏。然后你可以写下你想要替换的单词部分以及你想要替换的内容。

此外,还有一个选项可以勾选in selection,这样,替换将只发生在您选择的代码部分