右 |在弄乱 gsubfn 的空格中生成“\”的变量
R | Variable generating " \ " in empty spaces that messes up gsubfn
当我 运行 我的变量时,它会在空白处生成“\”。
有没有办法去除“\”或保持变量文本的原始格式?
topheader<-'<div id="editor1" class="shinytinymce shiny-bound-input"
style="resize: none; width: 100%; height: 100%; border-style: none;
background: gainsboro;">'
print(topheader)
[1] "<div id=\"editor1\" class=\"shinytinymce shiny-bound-input\"
style=\"resize: none; width: 100%; height: 100%; border-style: none;
background: gainsboro;\">"
字符串\"
代表一个双引号字符。 R 以这种方式打印它,因为它将所有字符串打印为双引号,因此它需要转义内部双引号。
如果要将字符值视为实际写入的字符,请使用 cat
:
cat(topheader)
# <div id="editor1" class="shinytinymce shiny-bound-input"
# style="resize: none; width: 100%; height: 100%; border-style: none;
# background: gainsboro;">
当我 运行 我的变量时,它会在空白处生成“\”。
有没有办法去除“\”或保持变量文本的原始格式?
topheader<-'<div id="editor1" class="shinytinymce shiny-bound-input"
style="resize: none; width: 100%; height: 100%; border-style: none;
background: gainsboro;">'
print(topheader)
[1] "<div id=\"editor1\" class=\"shinytinymce shiny-bound-input\"
style=\"resize: none; width: 100%; height: 100%; border-style: none;
background: gainsboro;\">"
字符串\"
代表一个双引号字符。 R 以这种方式打印它,因为它将所有字符串打印为双引号,因此它需要转义内部双引号。
如果要将字符值视为实际写入的字符,请使用 cat
:
cat(topheader)
# <div id="editor1" class="shinytinymce shiny-bound-input"
# style="resize: none; width: 100%; height: 100%; border-style: none;
# background: gainsboro;">