My code is somewhat like this- I want to take an output from the select input and show only the "site and it's link. Ex- If I select google from selectInput, then output should be-
o/p
Site Link
Google https://www.google.co.in/(can be clicked)
Yes, I do. In my main program I have put up the links in a reactive function. Like this-
link_diploma<- reactive({
li<-d_course() %>% filter(`Discipline Category1`== input$diploma_courses) %>%
filter(Subject1 == diploma_spec()) %>% pull(`Program Website`)
li<- data.frame(li)
names(li)[1]<- "Links"
li<- li%>% head(5)
return(li)
})```
I am then using reactive function in the solution you provided.
output$t1 <- shiny::renderDataTable({
enframe(paste0("<a href='",**link_diploma()**,"'>",**link_diploma()**,"</a>"),value="link",name=NULL)
}, escape=FALSE,
options = list(dom = 't',
searching= FALSE))
))))
})
Tell me where I am going wrong.?
the asterix's are for emphasis and not in your code I hope ?
what sort of an object is link_diploma() is it character vector that needs enframing to make into a data.frame as in your original example ?
I'm thinking not, as link_diploma reactive is a data.frame(li) with head applied on it.
You can't enframe a data.frame, its already framed...
link_diploma is the reactive function for links of diploma education. Yes, it is character.
let me break this-
d_course- is the reactive dataframe of all types of education with their links.
discipline Category1- type of Discipline(like- Arts, science, Computers)
input$diploma_courses- the selected diploma course from selectInput.
Subject1- Type of subjects in the discipline(Ex- For Arts discipline, Subject1- Arts and
Humanities, Arts and cultures, Heritage)
diploma_Spec- it's the selected Input of subject1
Program site- the website for the programs we have selected after the filtration.
li- is th variable to store within the reactive function, so that I can return it easily.
head(5)- to return the only top 5 websites of the Programs.
I made it a dataframe so that I can add operations in it easily if needed furthermore, I can remove it too.
choose between passing a character vector of links as your reactive, which the other function will enframe.
or else prepare the data.frame in the reactive and dont enframe it a second time.
There is no singular correct way to do it, its up to you. but you need to be consistent in your approach. good luck.