Multiple links in same table cell

Hello, I'm a beginner in shiny and I'm having some trouble with inserting multiple links in the same table cell. Every link allows the user to download local files on the computer.

This is also my first time asking a question on a public forum, so I apologize if I do something wrong; please do tell me and I'll immediately correct my mistake. I can't add a reprex as the project is huge and too complicated to do so. However, I'll add images as well as chunks of code that should be enough to show my problem.

In the following table, every blue word is obviously a hyperlink. For every sample name, the code checks if the file of every column is present, and if so, prints "Yes" (except the last column, which I'll get to later and is my issue). When the user clicks on it, the corresponding file starts downloading. For example, let's take sample RAW-20D0001. Columns 2, 3, and 4 all show "Yes", which means the specific file for quality control, that for BWA, and that for Annotation are present. When I click on "Yes", the correct file starts downloading.

Here's the code for how I did what I just described (columns 2, 3, and 4):
Note: The variable 'table' was already created and filled before running the shiny app and includes the exact content as the table above. For the sake of clarity, here are the contents of the first row (I wanted to attach a picture of it but wasn't allowed because I'm a new user):

table[,1]: 
Sample names 
"RAW-20D0001" 
Quality Control 
"Yes" 
BWA 
"Yes" 
Annotation 
"Yes" 
Gene panel 
"EPILEPSY GENE PANEL.csv<br>INTELLECTUAL DISABILITY GENE PANEL.csv<br>LEUKODYSTROPHY GENE PANEL.csv<br>METABOLIC DISORDERS GENE PANEL.csv<br>MOVEMENT DISORDERS GENE PANEL.csv<br>MUSCLE DISORDERS GENE PANEL.csv"

Here's the code:

lapply(1:nrow(table), function(i) {
    if (table[i,2]=="Yes"){ # for 'Quality Control' column 
    output[[paste0("downloadData", i, 1)]] <- downloadHandler(
      filename=paste("./FastQC/", table[i,1], "_trimmed_R1_paired_fastqc/fastqc_report.html", sep=""),  
      content = function(file) {
        file.copy(paste("./FastQC/", table[i,1], "_trimmed_R1_paired_fastqc/fastqc_report.html", sep=""), file)
      }
    )}
    if (table[i,3]=="Yes"){ # for 'BWA' column
      output[[paste0("downloadData", i, 2)]] <- downloadHandler(
        filename=paste("./VCF/", table[i,1], "_ann_vcf.csv", sep=""),  
        content = function(file) {
          file.copy(paste("./VCF/", table[i,1], "_ann_vcf.csv", sep=""), file)
        }
      )}
    if (table[i,4]=="Yes"){ # for 'Annotation' column
      output[[paste0("downloadData", i, 3)]] <- downloadHandler(
        filename=paste("./VCF/", table[i,1], "_ann_vcf.csv", sep=""),  
        content = function(file) {
          file.copy(paste("./VCF/", table[i,1], "_ann_vcf.csv", sep=""), file)
        }
      )}
})


  output$hidden_downloads_fastq <- renderUI( # for 'Quality Control' column 
    lapply(1:nrow(table), function(i) {
      downloadLink(paste0("downloadData", i, 1), "download", class = "hiddenLink")
    }))
  
  output$hidden_downloads_bwa <- renderUI(  # for 'BWA' column
    lapply(1:nrow(table), function(i) {
      downloadLink(paste0("downloadData", i, 2), "download", class = "hiddenLink")
    }))
  
  output$hidden_downloads_annotation <- renderUI( # for 'Annotation' column
    lapply(1:nrow(table), function(i) {
      downloadLink(paste0("downloadData", i, 3), "download", class = "hiddenLink")
    }))

Then, to display the links in the table, I did:

 output$table <- renderDataTable({
    table=as.data.frame(table)%>%
      mutate("Quality Control" = lapply(1:n(),
                           function(i)
                           { if (table[i,2]=="Yes"){
                             paste0('<a href="#" onClick=document.getElementById("downloadData',i, 1,'").click() >Yes</a>')}
                             else 
                               paste0("No")}
      ))%>% mutate("BWA" = lapply(1:n(),
                                  function(i)
                                  { if (table[i,3]=="Yes"){
                                    paste0('<a href="#" onClick=document.getElementById("downloadData',i,2, '").click() >Yes</a>')}
                                    else 
                                      paste0("No")}))%>% mutate("Annotation" = lapply(1:n(),
                              function(i)
                              { if (table[i,4]=="Yes"){
                                paste0('<a href="#" onClick=document.getElementById("downloadData',i,3, '").click() >Yes</a>')}
                                else 
                                  paste0("No")}))
  table
  }, escape = F)

I don't know if this is the best way to do this (I got it from Google), but it's working perfectly so I don't mind.

However!!! the last column, "Gene Panel", is giving me a hard time. The reason is because as opposed to the other columns, each cell in this column has multiple download links. For example, if the user clicks on 'EPILEPSY GENE PANEL.csv' of the first sample, they'll download the specific EPILEPSY GENE PANEL for the first sample, and the same for INTELLECTUAL DISABILITY GENE PANEL and all other "Gene panel" options. I tried to do the same thing as I did for the other columns but this time for multiple links in the same cell, but it's not working.

 lapply(1:nrow(table), function(i) {
 if (table[i,5]!="No panels")
    {
      panels=strsplit(table[i,5], "<br>")
      panels=panels$`Gene panel`
      for (j in 1:length(panels)){
      output[[paste0("downloadData", i, j, 4)]] <- downloadHandler( # as opposed to before, I added here another variable 'j' in the name of the output variable to differentiate between the different panels for each sample name
        filename=paste("./Gene_panel/", table[i,1], "_", panels[j], sep=""),  
        content = function(file) {
          file.copy(paste("./Gene_panel/", table[i,1], "_", panels[j], sep=""), file)
        }
      )}}
    }
  )

output$hidden_downloads_panel <- renderUI(
    lapply(1:nrow(table), function(i) {
      if (table[i,5]!="No panels"){
      panels=strsplit(table[i,5], "<br>")
      panels=panels$`Gene panel`
      for (j in 1:length(panels)){
      downloadLink(paste0("downloadData", i, j, 4), "download", class = "hiddenLink") # also added 'j' here
      }
      }
    }))

  output$table <- renderDataTable({ # here, it's the same as before but I just added the last '%>% mutate' to accommodate the last column 'Gene panel'
    table=as.data.frame(table)%>%
      mutate("Quality Control" = lapply(1:n(),
                           function(i)
                           { if (table[i,2]=="Yes"){
                             paste0('<a href="#" onClick=document.getElementById("downloadData',i, 1,'").click() >Yes</a>')}
                             else 
                               paste0("No")}
      ))%>% mutate("BWA" = lapply(1:n(),
                                  function(i)
                                  { if (table[i,3]=="Yes"){
                                    paste0('<a href="#" onClick=document.getElementById("downloadData',i,2, '").click() >Yes</a>')}
                                    else 
                                      paste0("No")}))%>% mutate("Annotation" = lapply(1:n(),
                              function(i)
                              { if (table[i,4]=="Yes"){
                                paste0('<a href="#" onClick=document.getElementById("downloadData',i,3, '").click() >Yes</a>')}
                                else 
                                  paste0("No")}))%>% mutate("Gene panel" = lapply(1:n(),
                                     function(i)
     if (table[i,5]!="No panels"){
        panels=strsplit(table[i,5], "<br>")   
        panels=panels$`Gene panel`
        list=c()
        for (j in 1:length(panels))
        {
        list=append(list,paste0('<a href="#" onClick=document.getElementById("downloadData', i, j, 4, '").click() >', panels[j], '</a>')) 
        }
        paste0(list, collapse="<br>")
      }
    else
      paste0("No panels")                 
))
    table
  }, escape = F)

For some reason, this is not working! I would appreciate any help. I've been trying to solve this for weeks, but as I said I'm still a beginner and teaching myself as I go.
Please let me know if anything is unclear.

Thank you in advance!