RGui(Windows;R 版本 3.5.3)似乎忽略了出现在字符串中行首的制表符(在代码行上按CTRL+ R):
# REPLACE "<TAB>" WITH AN ACTUAL TAB CHARACTER TO GET THE CODE INTENDED BELOW.
foo <- 'LINE1
<TAB>LINE2
<TAB>LINE3
'
foo
# [1] "LINE1\nLINE2\nLINE3\n"
longstring <- removetabsatbeginningoflines('
<TAB>Sometimes I have really long strings that I format
<TAB>so that they read nicely (not with too long of a
<TAB>line length). Tabs at the beginning of the lines
<TAB>within a string preserve my code indenting scheme
<TAB>that I use to make the code more readable. If the
<TAB>tabs are not removed automatically by the parser,
<TAB>then I need to wrap the string in a function that
<TAB>removes them.')
当上述代码source
从文件中提取时,制表符将被保留。
- 为什么 RGui 不保留制表符?
- 这种行为记录在哪里?
- RGui 在解析(多行)字符串方面还有哪些其他非直观的相关行为?