R shiny app nightmare

Hello,

I'm coming to you with this project that is seriously poisoning my health,

I'm trying to make a shiny interactive site to present my biology internship data and it's pain in the *** continuously, this is not contractual but rather a bonus that I want to succeed as a personal project in order to progress in my professional skills

This is my first website, I already have a basic knowledge of HTML/CSS and I'm suffering, the debugging is horrible and I never understand anything I'm asked to do, unlike R markdown in particular where it's really very simple

I work on R studio Cloud with an encoding in UTF-8

Here is my code

# APPLICATION WEB PROJET M2 - PHYLOGENIE MOLECULAIRE DES BRENTIDAE ACRATINI 

# LOAD DATA - - - - - - - - - - - - - - - - 


# PACKAGES - - - - - - - - - - - - - - - - 

library(shiny)              # shiny web interactif
library(shinythemes)        # theme couleur general de l'application
library(shinydashboard)     # Ă  voir mais potentiellement pas utile (visiblement cela rentre en conflit avec le code d'une app normale)
library(dendextend)         # modification et contrĂ´le des objets de type arbre ("dendrogram")
library(DT)                 # Datatable classe pour illustrer les datasets

# Représentation graphique 

library(circlize)       # pour faire des circos plot vraiment très joli
#library(ggtree)        # manipulation très pratique d'arbre phylogénétique 
library(ggplot2)        # faire de joli plot 
library(ggpubr)         # pour représenter les plots côtes à côtes de manière classe 
library(leaflet)        # faire une très joli carte sur fond de Javascript 

# SOURCES - - - - - - - - - - - - - - - - 

# https://chlorobox.mpimp-golm.mpg.de/OGDraw.html => tool for plotting easy circos plot from molecular data

# CODE UI - - - - - - - - - - - - - - - - 


# Define UI for application that draws a histogram
shinyUI(fluidPage(id = 'test',
                  tags$style('#test {
                             background-color: #FFFBF5; 
              }'),
                  
                  # - - - TITRE & IMAGES DE GARDE                     
                  
                  titlePanel(""),
                  HTML('<center><img src="https://www.dropbox.com/s/i6ot98mblktmcyc/Brentidae%20Acratini%20Phylogeny%20-%20Copie.png?dl=1" height="300vh"></center>'),
                  br(),
                  
                  # - - - - NAVBAR / Onglet
                  navbarPage("Let's get started"),
                  tabPanel(icon("home"),
                           fluidRow(column(
                             tags$img(src="https://www.dropbox.com/s/mwqbiuf1yk2th8n/Carte_Amerique_Sud_avec_%20Acratini.png?dl=1",width="200px",height="300px"),width=2,
                             br(),
                             p(em("Teramocerus pulchellus Perroud 1853"),br(),"Acratini",a(href="https://www.gbif.org/fr/species/4238", "- GBIF",target="_blank"),style="text-align:center;color:black")
                           ),
                           column(
                             br(),
                             p("The Curculionoidea beetles (the 'weevils') form one of the largest current zoological groups with about 70,000 
                                                 described species and are particularly diverse in tropical regions (OBERPRIELER et al., 2014). The exclusively 
                                                 Neotropical tribe Brentidae Acratini currently comprises 107 species, divided into 14 genera. Despite several 
                                                 papers published in recent years on the systematics of this group (i.e. MANTILLERI, 2015 a, b, c, 2016, 2017), 
                                                 many taxa belonging to this tribe are of enigmatic affinity and do not appear to belong to any of the currently 
                                                 defined genera. Although no phylogeny of the group has yet been published, the availability of several hundred 
                                                 specimens from the National History Museum of Paris and the access to new generation sequencing 
                                                 techniques in collaboration with the Metazoa Phylogenomics laboratory in Barcelona motivate the realisation of 
                                                 this internship in order to propose a novel work on phylogenomics.",style="text-align:justify;color:black;background-color:lightgreen;opacity:0.8;padding:15px;border-radius:10px"),
                             br(),
                             
                             p("The aim of the intership is to develop the first phylogeny of this tribe using phylogenetic reconstruction 
                                                   methods (12 mitochondrial and 2 nuclear genes). nuclear genes). This internship will allow the student to be
                                                   trained",br(),strong("(1) in the protocol of extraction of molecular material from from collection specimens,
                                                   Sanger and next generation sequencing"),br(), strong("(2) mitochondrial genome assembly and alignment"),
                               br(), strong("(3) and phylogenetic reconstruction phylogenetic reconstruction methods, including maximum 
                                                   likelihood and Bayesian inference"),style="text-align:justify;color:black;background-color:palegreen;opacity:0.7;padding:15px;border-radius:10px"),
                             
                             width=8),
                           column(
                             br(),
                             tags$img(src="https://www.dropbox.com/s/b67dzexr0erhqhq/Metazoan%20Phylogeny%20Lab%20pantalla.png?dl=1",height="220px",height="130px"),
                             br(),
                             br(),
                             p("For more information please check the",em("Metazoan Phylogeny Lab's"),"page clicking",
                               br(),
                               a(href="https://www.ibe.upf-csic.es/metazoa-phylogenomics", "Here",target="_blank"),style="text-align:center;color:black"),
                             
                             width=2)),
                           
                           hr(),
                           p(em("Developed by Thibaud Glinez"),style="text-align:center; font-family: times"),
                           hr()
                  ),
                  
                  
                  
                  
            # - - - - FOOTER       
                  
          
fluidRow(
  
  # - - - Left Column Brentid Logo 
  
  column(
    tags$img(src="https://www.dropbox.com/s/4abpyb9g72jw3xi/Nature.png?dl=1",width="300px",height="300px"),width=2,
    br()
        )
  

  # - - - Right Column Contact info 
  
  #column(
   
  #   p("oui"),
  
  #       ) # Column End 
  
) # fluidRow End

This is what it looks like at the moment:

I'm only dealing with the UI part for the moment.

Here is my main problem, I systematically get this error:

101: )) ^ Warning: Error in sourceUTF8: Error sourcing /cloud/project/Projet_M2_Phylogenie/ui.R [No stack trace available]

Either always a problem of adding or on the contrary of removing brackets without that makes sense for the last row. So I can't add blocks in my project, either in the "NavBar" that I have to fill in or in the footer

Please could you tell me if all this is normal?

I am not an expert in R but not a beginner and this is causing me a lot of trouble

It's a bit sad from there because it really seems to be a powerful way for sharing data

The error message

101: )) ^ Warning: Error in sourceUTF8: Error sourcing /cloud/project/Projet_M2_Phylogenie/ui.R [No stack trace available]

suggests an encoding problem. This can happen if the host is using LOCALE encoding by default. Try using the File | Reopen with Encoding | UTF-8 feature in RStudio

1 Like

Yep of course I am okay with this solution, unfortunately the system default on Rstudio Cloud is already UTF-8.

Also it's even more difficult to run thing in my local Rstudio on my computer whithout knowing why, that's why I also did it on Cloud and that was working better

djdj

There really is no alternative to being precise with your brackets. Its clear from what you shared they are significantly unbalanced. Its just a part of programming in general, that the computer needs the brackets to be correct.
If you are finding that you are confusing yourself with long monolithic code you can use standard techniques..
Things like a) write smaller functions, b) have the smaller functions written contained in smaller code files that are sourced in by the main code file

2 Likes

Re!

Well, I've made some progress and I've done the footer in a way that's not too horrible for me and that works well

It is pleasant,

However a problem subsists and prevents me completely from continuing, that takes my head if you could help me I would be grateful,

I am desperately trying to put several pages in NavBar with TabPanel but nothing works. Independently, I have recovered some code from the side and it works (R-Shinyapp-Tutorial/shinylayouts/navbarpage demo/ui.R at master · aagarw30/R-Shinyapp-Tutorial · GitHub) but I can't integrate it into my current code or rebuild my code on top of it, keeping the tabs already made.

I share my code with you:

# APPLICATION WEB PROJET M2 - PHYLOGENIE MOLECULAIRE DES BRENTIDAE ACRATINI 

# LOAD DATA - - - - - - - - - - - - - - - - 


# PACKAGES - - - - - - - - - - - - - - - - 

library(shiny)              # shiny web interactif
library(shinythemes)        # theme couleur general de l'application

# CODE UI - - - - - - - - - - - - - - - - 


# Define UI for application that draws a histogram
shinyUI(fluidPage(id = 'test',
                  tags$style('#test {
                             background-color: #FFFBF5; 
              }'),
                  
                  # - - - TITRE & IMAGES DE GARDE                     
                  
                  HTML('<center><img src="**link picture**" height="300vh"></center>'),
                  br(),
                  
                  # - - - - NAVBAR / Onglet
                  navbarPage("Homepage"),
                  tabPanel(icon("home"),
                           fluidRow(column(
                             tags$img(src="**link picture**",width="200px",height="300px"),width=2,
                             br(),
                             p(em("Teramocerus pulchellus Perroud 1853"),br(),"Acratini",a(href="https://www.gbif.org/fr/species/4238", "- GBIF",target="_blank"),style="text-align:center;color:black")
                           ),
                           column(
                             br(),
                             p("The Curculionoidea beetles (the 'weevils') form one of the largest current zoological groups with about 70,000 
                                                 described species and are particularly diverse in tropical regions (OBERPRIELER et al., 2014). The exclusively 
                                                 Neotropical tribe Brentidae Acratini currently comprises 107 species, divided into 14 genera. Despite several 
                                                 papers published in recent years on the systematics of this group (i.e. MANTILLERI, 2015 a, b, c, 2016, 2017), 
                                                 many taxa belonging to this tribe are of enigmatic affinity and do not appear to belong to any of the currently 
                                                 defined genera. Although no phylogeny of the group has yet been published, the availability of several hundred 
                                                 specimens from the National History Museum of Paris and the access to new generation sequencing 
                                                 techniques in collaboration with the Metazoa Phylogenomics laboratory in Barcelona motivate the realisation of 
                                                 this internship in order to propose a novel work on phylogenomics.",style="text-align:justify;color:black;background-color:lightgreen;opacity:0.8;padding:15px;border-radius:10px"),
                             br(),
                             
                             p("The aim of the intership is to develop the first phylogeny of this tribe using phylogenetic reconstruction 
                                                   methods (12 mitochondrial and 2 nuclear genes). nuclear genes). This internship will allow the student to be
                                                   trained",br(),strong("(1) in the protocol of extraction of molecular material from from collection specimens,
                                                   Sanger and next generation sequencing"),br(), strong("(2) mitochondrial genome assembly and alignment"),
                               br(), strong("(3) and phylogenetic reconstruction phylogenetic reconstruction methods, including maximum 
                                                   likelihood and Bayesian inference"),style="text-align:justify;color:black;background-color:palegreen;opacity:0.7;padding:15px;border-radius:10px"),
                             
                             width=8),
                           column(
                             br(),
                             tags$img(src="**link picture**",height="220px",height="130px"),
                             br(),
                             br(),
                             p("For more information please check the",em("Metazoan Phylogeny Lab's"),"page clicking",
                               br(),
                               a(href="https://www.ibe.upf-csic.es/metazoa-phylogenomics", "Here",target="_blank"),style="text-align:center;color:black"),
                             
                             width=2)),
                           
                           hr(),
                           p(em("Developed by Thibaud Glinez"),style="text-align:center; font-family: times"),
                           hr()
                  ),
                  
                
                  
                  
                  # - - - - FOOTER       
                  
                  
                  fluidRow(
                    
                    # - - - GREY CONTAINER FOOTER ABAJO 
                    
                    column(
                      
                      # - - - Left Column Logo 
                      
                      column(
                        tags$img(src="**link picture**",
                                 width="260px",
                                 height="300px"),
                        width=2),
                      
                      # - - - Mid Column Contact 
                      
                      column(
                        
                        br(),
                        
                        # - - - Click link
                        
                        p("Contact",
                          hr(),
                          p(
                            a(href="https://www.linkedin.com/", img(src="https://www.dropbox.com/s/ltmbs6c1vzmmez7/LinkedIn_logo_initials.png?dl=1",height="20px",height="23px"),target="_blank"),"  LinkedIn",
                            br(),
                            a(href="https://www.researchgate.net/", img(src="https://www.dropbox.com/s/n14y2t5nl5ko1s9/1200px-ResearchGate_icon_SVG.svg.png?dl=1",height="20px",height="23px"),target="_blank"),"  ResearchGate",
                            br(),
                            a(href="https://github.com/", img(src="https://www.dropbox.com/s/1tmbz0cg27od6xq/GitHub%20logo.png?dl=1",height="20px",height="23px"),target="_blank"),"  GitHub",
                            br(),
                            a(href="mailto:yes@gmail.com", img(src="https://www.dropbox.com/s/knmx8221xtr398n/Mail%20d%C3%A9tour%C3%A9.png?dl=1",height="20px",height="23px"),target="_blank"),"  Mail",
                            
                            
                            style="text-align:justify;font-size:18px;color:black;padding-left:5px"),
                          
                          
                          style="text-align:justify;font-size:small;color:black;padding:40px"),
                        
                        width=3),
                      
                      
                      
                      # - - - Mid Column Contact 
                      
                      column(
                        
                        br(),
                        
                        p("Informations",
                          hr(),
                          p("This site was built using Rstudio Cloud version 4.2.0 and subsequently implemented on R Shiny support. 
                                In addition to the educational aspect of the presentation of the data of an internship of end of Master's
                                course, this project is part of a more personal dynamics aiming at acquiring new competences in data processing
                                in order to supplement my current professional course. ",
                            
                            style="text-align:justify;font-size:16px;color:black"),
                          
                          
                          style="text-align:justify;font-size:small;color:black;padding:40px"),
                        width=7),
                      
                      
                      # - - - GREY CONTAINER FOOTER (width maximum)
                      
                      
                      style="background-color:#f4f4f4",
                      width=12)
                  ),
                  
                  # - - - Green End row 
                  
                  fluidRow(column(style="background-color:#6fb241;padding:3.5px",width = 12))
))

Can you help me understand why I never get anything when I try to insert a second tabPanel in the NavBar with other information

The goal would be as follows:

It would really help me if you could unlock me!!!!

Thanks in advance

This topic was automatically closed 54 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.