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,752
  • 1
  • 21
  • 38

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
  • 874,273
  • 37
  • 540
  • 662
3

You need to escape double quotes:

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

Demo

Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360