小编ran*_*ndy的帖子

使用system2()而不是system()从R运行Powershell脚本?

我有一个PowerShell脚本(例如在C:\ directoryName\coolScript.ps1).如果我想从R调用它,我可以运行

system('powershell -file "C:\\directoryName\\coolScript.ps1"')
Run Code Online (Sandbox Code Playgroud)

如果我尝试执行相同操作system2(),则不返回任何错误,但不执行脚本.由于该system()命令的文档说system2()"建议用于新代码",我想使用system2().有没有办法做到这一点?

powershell r

7
推荐指数
1
解决办法
3315
查看次数

Tidyverse:为什么在将 helper 放置在 cross 内部时,选择 helper 会通过管道传递到 cross() 抛出有关外部向量的注释/警告/错误?

将选择助手 ( 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)

r dplyr tidyverse across

1
推荐指数
1
解决办法
51
查看次数

标签 统计

r ×2

across ×1

dplyr ×1

powershell ×1

tidyverse ×1