用于Windows的R中的反斜杠消除 [英] Relief from backslash irritation in R for Windows

查看:148
本文介绍了用于Windows的R中的反斜杠消除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的R生涯的早期,当谈到目录和子目录之间的分隔符时,我发现R和Windows在不同页面上的痛苦.尽管我知道这个问题,但仍然感到痛苦,因为我必须手动在所有反斜杠前面加上一个反斜杠,或者用正斜杠替换所有反斜杠.

Early in my R life I discovered the pain of R and windows being on different pages when it came to the separator between directories and subdirectories. Eventhough I know about the problem, I am still pained by manually having to put a backslash in front of all my backslashes or replacing all of them with forward slashes.

我喜欢使用计算机上运行的多个应用程序(例如XYPlorer,Everything通过voidtools)中的任何一个复制路径名或完整文件名,然后将其粘贴到Tinn-R中.无论如何,我是否可以自动化当前正在手动执行的任务.

I love copying a path name or an entire filename with any one of several applications that I have running on my computer (eg. XYPlorer, Everything by voidtools) and then pasting it into Tinn-R. Is there anyway that I could automate the task that I am currently doing manually.

  • Tinn-R中有设置吗?
  • R中有设置吗?
  • 默认情况下是否有一个自动热键脚本可以为我执行此操作?

不知道我在说什么的人的背景

Background for those who don't know what I am talking about

R引用Windows常见问题解答,R-2.9.2版本,B.D. Ripley和D. J. Murdoch

Quoting from R for Windows FAQ, Version for R-2.9.2, B. D. Ripley and D. J. Murdoch

反斜杠必须在R中加倍 字符串,例如 需求 "d:\ R-2.9.2 \ library \ xgobi \ scripts \ xgobi.bat"". 您可以让自己的生活更轻松 通过使用正斜杠作为路径 分隔符:它们确实在Windows下工作

Backslashes have to be doubled in R character strings, so for example one needs `"d:\R-2.9.2\library\xgobi\scripts\xgobi.bat"'. You can make life easier for yourself by using forward slashes as path separators: they do work under Windows

推荐答案

我编写了一个 autohotkey 脚本,该脚本是通过键入"rfil"来触发的-不包含逗号.

I wrote a autohotkey script that is triggered by typing "rfil " - without the inverted commas.

:O:rfil:: ;replaces backslashes with forward slashes in a file name that is stored on the clipboard
StringReplace,clipboard,clipboard,\,/,All
send %clipboard%
return

如果有人能告诉我比使用send命令更快的方法,我将不胜感激. 我在所有计算机上始终都运行着一个自动热键脚本,因此不必为了运行该脚本而下载新软件.我只是将其添加到默认脚本文件中.

If anyone can tell me a quicker way than using the send command I would appreciate it. I have an autohotkey script running all the time on all my computers so I did not have to download new software in order to run this script. I simply added it to my default script file.

如果您要我做的话,我会很乐意解释.

I will be happy to explain what I did if you want me to.

这篇关于用于Windows的R中的反斜杠消除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆