1

I am trying to assign a URL to a variable

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

but I get the

CMS.R:49:22: unexpected symbol

I did search previous answers and tried escaping with \ and what not but to no avail. Thanks in advance for your help.

devnull
  • 2,575
  • 1
  • 17
  • 32

2 Answers2

3

We can do the outside quote with single quotes

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\">"

The demo is here

akrun
  • 789,025
  • 32
  • 460
  • 575
3

You need to escape double quotes:

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

Demo

Tim Biegeleisen
  • 451,927
  • 24
  • 239
  • 318