captcoma
captcoma

Reputation: 1898

Add a hyperlink to a .R file (not R markdown file)

I would like to add clickable a hyperlink (e.g. https://cran.r-project.org/web/packages/tm.plugin.factiva/index.html) to a .R file.

I found a solution for a R markdown files (How do I add a URL to R markdown?), however, I could not find a solution to enter hyperlinks directly into .R files.

I thought about to add a hyperlink as #https://cran.r-project.org/web/packages/tm.plugin.factiva/index.html

Is there any other solution?

Upvotes: 1

Views: 998

Answers (1)

Clark Thomborson
Clark Thomborson

Reputation: 180

If you want to document your R code with clickable hyperlinks (and formatted lists, typeset equations, etc.), I recommend roxygen2. RStudio offers excellent workflow support for creating documentation for "oxygenated" R code.

However if your intent is to write a "self-documenting" .R file, then your idea (of including a URL in a comment) is fine. The person who is reading your .R file will understand your intended reference even if you don't decorate your URL with the angle brackets or square brackets-and-parentheses that'd be required for it to be interpreted as a link in the document-compilation workflow for an oxygenated code.

Upvotes: 1

Related Questions