我有一个PowerShell脚本(例如在C:\ directoryName\coolScript.ps1).如果我想从R调用它,我可以运行
system('powershell -file "C:\\directoryName\\coolScript.ps1"')
Run Code Online (Sandbox Code Playgroud)
如果我尝试执行相同操作system2(),则不返回任何错误,但不执行脚本.由于该system()命令的文档说system2()"建议用于新代码",我想使用system2().有没有办法做到这一点?
将选择助手 ( matches(), contains(), starts_with(), ends_with())管道化(的值)到across()函数的行为与将选择助手放在 的括号内的行为不同across()。
library(dplyr)
# Very simple function: returns input
self = function(x){x}
# Data to manipulate
dtemp = tibble(var = 1:2)
# No note/warning/error when selection helper is inside across()
dtemp %>% mutate(across(matches("var"), self))
# Note/warning/error when selection helper is piped to across()
dtemp %>% mutate(matches("var") %>% across(self))
Run Code Online (Sandbox Code Playgroud)
最后一行导致 R 打印
Note: Using an external vector in selections is ambiguous.
i Use `all_of(.)` …Run Code Online (Sandbox Code Playgroud)