【发布时间】:2016-05-07 04:52:25
【问题描述】:
我想知道如何在 R 的同一行中容纳两种以上的引号。假设我要打印:
'first-quote-type1 "first-quote-type2 "second-quote-type2 '第二引号类型1
在开头使用一个引号,在结尾使用一个引号:
print("'first-quote-type1 "first-quote-type2 "second-quote-type2 'sencond-quote-type1")
错误:"print("'first-quote-type1 "first"中出现意外符号
在这种情况下,我尝试在 Python 中包含三引号:
print(''''first-quote-type1 "first-quote-type2 "second-quote-type2 'sencond-quote-type1''')
print("""'first-quote-type1 "first-quote-type2 "second-quote-type2 'sencond-quote-type1""")
但是,我也遇到了类似的错误。一些想法如何使这种语法在 R 中工作?
【问题讨论】:
-
我很好奇:你为什么要这样做?
-
我想使用基本函数
system()直接从R实现一个bash代码。我在这里使用print()只是为了让问题更清楚。
标签: r syntax quotes double-quotes