gpt4 book ai didi

r - 单击 R 字符串输出中的 URL

转载 作者:行者123 更新时间:2023-12-01 01:51:44 25 4
gpt4 key购买 nike

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

cat("https://en.wikipedia.org/wiki/Statistics")
# Output: https://en.wikipedia.org/wiki/Statistics

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

最佳答案

正如您在评论中提到的,您正在使用 RStudio。我们还没有在这里解释为什么它必须是 R 中的控制台,但我认为有充分的理由在 RStudio 中显示链接,并且我认为控制台右侧的查看器 Pane 也适用于您。

如果是这种情况,您可以执行以下操作:

library(DT)    # for datatable() function
library(shiny) # for tags$a() function
data <- data.frame(link = toString(tags$a(href = paste0("http://google.de"), "google")))
datatable(data, escape = FALSE)

非常靠近控制台;)
enter image description here

关于r - 单击 R 字符串输出中的 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43923974/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com