R 中的 URL 转义

  • 本文关键字:转义 URL 中的 r
  • 更新时间 :
  • 英文 :


我正在尝试为变量分配一个 URL

css <- " <link href="https://cloud.typography.com/2/1/css/fonts.css" rel="stylesheet">"

但我明白

CMS.R:49:22: unexpected symbol

我确实搜索了以前的答案,并尝试使用 \ 和什么转义,但无济于事。提前感谢您的帮助。

我们可以用单引号做外部引号

css <- '<link href="https://cloud.typography.com/2/1/css/fonts.css" rel="stylesheet">'
css
#[1] "<link href="https://cloud.typography.com/2/1/css/fonts.css" rel="stylesheet">"

演示在这里

您需要转义双引号:

css <- "<link href="https://cloud.typography.com/2/1/css/fonts.css" rel="stylesheet">"

演示

最新更新