单击 R 字符串输出中的 URL

use*_*756 8 string r

假设我有一个来自 R 的 cat 函数的输出,它是一个 URL。例如:

cat("https://en.wikipedia.org/wiki/Statistics")
# Output: https://en.wikipedia.org/wiki/Statistics
Run Code Online (Sandbox Code Playgroud)

在 cat 函数或任何其他东西上是否有任何命令,以便输出https://en.wikipedia.org/wiki/Statistics成为 R 控制台中的可点击 URL?

MBu*_*ham 0

这取决于如何查看输出。如果此输出将输出到 HTML 文件,那么您所需要做的就是将其设置为超链接的位置。

<a href="https://en.wikipedia.org/wiki/Statistics">https://en.wikipedia.org/wiki/Statistics</a>
Run Code Online (Sandbox Code Playgroud)

但是,例如,如果您只是在记事本中查看输出,那么我不相信记事本具有超链接功能。

我不相信 R 控制台直接支持超链接。但从这里看起来: http: //rmarkdown.rstudio.com/lesson-2.html你可以使用 R Markdown 来做你想做的事情。