我在data.frame中遇到了前导和尾随空格的麻烦.例如,我想看看在特定row的data.frame基础上有一定的条件:
> myDummy[myDummy$country == c("Austria"),c(1,2,3:7,19)]
[1] codeHelper country dummyLI dummyLMI dummyUMI
[6] dummyHInonOECD dummyHIOECD dummyOECD
<0 rows> (or 0-length row.names)
Run Code Online (Sandbox Code Playgroud)
我想知道为什么我没有得到预期的产量,因为奥地利显然存在于我的国家data.frame.在查看我的代码历史并试图弄清楚出了什么问题后,我尝试了:
> myDummy[myDummy$country == c("Austria "),c(1,2,3:7,19)]
codeHelper country dummyLI dummyLMI dummyUMI dummyHInonOECD dummyHIOECD
18 AUT Austria 0 0 0 0 1
dummyOECD
18 1
Run Code Online (Sandbox Code Playgroud)
我在命令中改变的是奥地利之后的另一个空格.
显然会出现更烦人的问题.例如,当我想根据国家/地区列合并两个帧时.一个data.frame用于"Austria "另一个帧"Austria".匹配不起作用.
到目前为止,我曾经写过一个Perl删除空格的简单脚本,但如果我可以在R里面以某种方式做到这一点会很好.
我喜欢用来git diff -w忽略空白差异.但是,我只是注意到它忽略了线条中间的空白差异.我怎么才能忽略行开头(^)或结尾($)的空白差异?
我在Visual Studio文本编辑器中有一个奇怪的错误.我的所有空格都被"."取代.
public class Person
{
int age;
}
Run Code Online (Sandbox Code Playgroud)
看起来像这样
public..class..Person..........................
{..................
..int age;...................
}.....................
Run Code Online (Sandbox Code Playgroud)
我将设置重置为默认值.没工作.我也重新安装了VS2008.仍然没有奏效.错误是什么?
我有我的文本编辑器在保存文件时自动修剪尾随空格,我正在为一个开源项目做出贡献,该项目在跟踪空白时存在严重问题.
每次我尝试提交补丁时,我必须首先忽略所有仅限空白的更改,以便仅选择相关信息.不仅如此,但是当我跑步时,git rebase我经常因为它们而遇到几个问题.
因此,我希望能够以类似的方式添加索引非空白更改git add -p,但不必自己选择所有更改.
有谁知道如何做到这一点?
编辑:我不能改变项目的工作方式,他们在邮件列表上讨论之后决定忽略这一点.
我有一些python代码分裂逗号,但不剥离空格:
>>> string = "blah, lots , of , spaces, here "
>>> mylist = string.split(',')
>>> print mylist
['blah', ' lots ', ' of ', ' spaces', ' here ']
Run Code Online (Sandbox Code Playgroud)
我宁愿最终删除这样的空格:
['blah', 'lots', 'of', 'spaces', 'here']
Run Code Online (Sandbox Code Playgroud)
我知道我可以遍历列表和strip()每个项目,但是,因为这是Python,我猜测有更快,更简单,更优雅的方式.
我从网页上复制并粘贴了一个git clone命令:https://fedorahosted.org/ibus-typing-booster/
我懂了:
user@host> git clone ??http://git.fedorahosted.org/git/ibus-typing-booster.git
Cloning into 'ibus-typing-booster'...
fatal: I don't handle protocol '??http'
Run Code Online (Sandbox Code Playgroud) 我不知道我做了什么,但我不知道如何摆脱左边的那些箭.

我是linux的新手,我想将文件从远程复制到本地系统...现在我在linux系统中使用scp命令..我有一些文件夹或文件名是带空格的,当我尝试复制时文件,它显示错误消息:"没有这样的文件或目录"
我试过了:
scp ael5105@192.168.0.200:'/home/5105/test/gg/Untitled Folder/a/qy.jpg' /var/www/try/
Run Code Online (Sandbox Code Playgroud)
我在网上看到了一些参考资料,但我不完全理解,有人可以帮忙吗?
如何在复制过程中转义文件名或目录名中的空格...
任何人都可以推荐一个安全的解决方案,从给定的根目录开始递归地用文件和目录名称中的下划线替换空格?例如:
$ tree
.
|-- a dir
| `-- file with spaces.txt
`-- b dir
|-- another file with spaces.txt
`-- yet another file with spaces.pdf
Run Code Online (Sandbox Code Playgroud)
变为:
$ tree
.
|-- a_dir
| `-- file_with_spaces.txt
`-- b_dir
|-- another_file_with_spaces.txt
`-- yet_another_file_with_spaces.pdf
Run Code Online (Sandbox Code Playgroud) 在Firefox中,只有我的视频缩略图在我的图像底部和边框之间显示神秘的2-3像素空白区域(见下文).
我已经尝试过在Firebug中我能想到的一切,但没有运气.
如何删除此空格?
