I have below code. it pasts ID (in my Data) to a link. I would like to know where can I use target="-blank" in this code to open it in a new browser?
DF <-data %>%
mutate( link = paste0("<a href='https://enhancer.lbl.gov/cgi-bin/imagedb3.pl?form=presentation&show=1&experiment_id=", ID, "&organism_id=1","'>Link</a>"))
output:
<a href='https://enhancer.lbl.gov/cgi-bin/imagedb3.pl?form=presentation&show=1&experiment_id=1912&organism_id=1'>Link</a>
CodePudding user response:
<h4>Simple Link Open in New Tab</h4>
<a href="https://www.youtube.com/c/hitechumair" target="_blank">Click Here</a>
<h4>Link with Button Open in New Tab</h4>
<button style="background-color:red;color:white;border-color:red;">
<a style="text-decoration:none;color:white;" href="https://www.youtube.com/c/hitechumair" target="_blank">Click Here</a></button>
<style>
button:hover{
background-color:black;
}
a:hover{
text-decoration:overline;}
</style>
CodePudding user response:
Since you use shiny you can use tags$a
:
tags$a(
href = paste0("https://enhancer.lbl.gov/cgi-bin/imagedb3.pl?form=presentation&show=1&experiment_id=", ID, "&organism_id=1"),
target = "_blank",
"Link"
)
As per your comment:
DF <- data %>%
mutate(
link = as.character(tags$a(
href = paste0("https://enhancer.lbl.gov/cgi-bin/imagedb3.pl?form=presentation&show=1&experiment_id=", ID, "&organism_id=1"),
target = "_blank",
"Link"
))
)
CodePudding user response:
link = paste0("<a ",'target="_blank"',' href="https://enhancer.lbl.gov/cgi-bin/imagedb3.pl?form=presentation&show=1&experiment_id=', ID, '&organism_id=1">Link</a>')
Hope this helps!