2017-12-01 18 views
-1

변수를 실행하면 빈 공간에 "\"가 생성됩니다.R | 변수가 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;\">" 
+2

그것은에 대한 이스케이프 문자 인' "'은 없다. – zx8754

답변

1

문자열 \"은 작은 따옴표를 나타냅니다. R은 모든 문자열을 큰 따옴표로 인쇄하므로 내부 큰 따옴표를 이스케이프해야하므로이 방법으로 인쇄합니다.

당신이 실제 기록 된 문자로 문자 값을보고 싶다면

, cat을 사용합니다.

cat(topheader) 
# <div id="editor1" class="shinytinymce shiny-bound-input" 
# style="resize: none; width: 100%; height: 100%; border-style: none; 
# background: gainsboro;">