The code below returns "http://www.yahoo.com" when I knit. How do I format it to just show Yahoo
with a clickable hyperlink?
Code Chunk -
count <- 3
cutoff <- 4
espn <- "http://espn.com"
yahoo <- "http://www.yahoo.com"
In Line -
r if(count > cutoff){espn} else {yahoo}
Hi,
Your issue is in a Rmardown document. If so, you can do something like this on your Rmarkdown:
count <- 3
cutoff <- 4
espn <- "http://espn.com"
yahoo <- "http://www.yahoo.com"
output<-NULL
name_output<-NULL
output <- if(count > cutoff){espn} else {yahoo}
name_output <- if(count > cutoff){'ESPN'} else {'YAHOO'}
[r name_output
](r output
)
It will Print Yahoo or ESPN depends on condition
Hope it help
2 Likes
going with Rodrigues general approach its also possible with
htmltools::a(name_output,
href=output)
@Rodrigue Thank you. This works.
Happy it's work for you.
Can you mark the solution so that people with a similar question can quickly see what worked for you.
1 Like
system
Closed
7
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.