Upload 3 files
Browse filesFiles changed (4)
- .gitattributes+1
- Dockerfile+34-11
- STATUS1.xlsxAdded+3
- app.R+53-46
31 unmodified lines3233343531 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -textSTATUS1.xlsx filter=lfs diff=lfs merge=lfs -text11233455678910111267814910111213141516171819202122232425262728293031323334353637FROM rocker/r-base:latestFROM rocker/shiny:latest
WORKDIR /code# Instalar pacotes R necessáriosRUN R -e "install.packages(c('shiny','readxl','dlookr','rpivotTable'), repos='https://cloud.r-project.org')"
RUN install2.r --error \ shiny \ dplyr \ ggplot2 \ readr \ ggExtra COPY . .# Criar diretório da appRUN mkdir -p /srv/shiny-server/app
CMD ["R", "--quiet", "-e", "shiny::runApp(host='0.0.0.0', port=7860)"]# Copiar arquivos da appCOPY app.R /srv/shiny-server/app/app.RCOPY STATUS1.xlsx /srv/shiny-server/app/STATUS1.xlsx
# Criar diretório www para relatóriosRUN mkdir -p /srv/shiny-server/app/www
# Configurar shiny-server para rodar na porta 7860 (Hugging Face Spaces)RUN echo "run_as shiny;\n\server {\n\ listen 7860;\n\ location / {\n\ site_dir /srv/shiny-server/app;\n\ log_dir /var/log/shiny-server;\n\ directory_index off;\n\ }\n\}" > /etc/shiny-server/shiny-server.conf
# Definir diretório de trabalhoWORKDIR /srv/shiny-server/app
# PermissõesRUN chown -R shiny:shiny /srv/shiny-server /var/log/shiny-server
# Expor porta 7860 (padrão Hugging Face Spaces)EXPOSE 7860
# Comando para iniciar o servidorCMD ["/usr/bin/shiny-server"]123version https://git-lfs.github.com/spec/v1oid sha256:27869b5509c04e945c22d2b0d7583dfefcc7944e9a1e5c5488bb3d9a10ac3fc7size 1962771234567891011121314151617234567891011121314151920212223241617181920212223242526272829303132282930333435363733343536373839404142383940414445464748495042434445464748525354554950515253545556575859606162636465library(shiny)library(bslib)library(dplyr)library(ggplot2)
df <- readr::read_csv("penguins.csv")# Find subset of columns that are suitable for scatter plotdf_num <- df |> select(where(is.numeric), -Year)
ui <- page_sidebar( theme = bs_theme(bootswatch = "minty"), title = "Penguins explorer", sidebar = sidebar( varSelectInput("xvar", "X variable", df_num, selected = "Bill Length (mm)"), varSelectInput("yvar", "Y variable", df_num, selected = "Bill Depth (mm)"), checkboxGroupInput("species", "Filter by species", choices = unique(df$Species), selected = unique(df$Species)library(readxl)library(dlookr)library(rpivotTable)
ui <- fluidPage( titlePanel("EDA no Browser – rpivotTable + dlookr"),
sidebarLayout( sidebarPanel( h4("Dataset"), p("Arquivo: STATUS1.xlsx"),
actionButton("diag", "Gerar diagnóstico dlookr") ), hr(), # Add a horizontal rule checkboxInput("by_species", "Show species", TRUE), checkboxInput("show_margins", "Show marginal plots", TRUE), checkboxInput("smooth", "Add smoother"), ), plotOutput("scatter")
mainPanel( tabsetPanel( tabPanel( "Pivot Table", rpivotTableOutput("pivot") ), tabPanel( "Diagnóstico", uiOutput("diag_ui") ) ) ) ))
server <- function(input, output, session) { subsetted <- reactive({ req(input$species) df |> filter(Species %in% input$species)
STATUS <- reactive({ read_excel("STATUS1.xlsx") })
output$scatter <- renderPlot( { p <- ggplot(subsetted(), aes(!!input$xvar, !!input$yvar)) + theme_light() + list( theme(legend.position = "bottom"), if (input$by_species) aes(color = Species), geom_point(), if (input$smooth) geom_smooth() ) output$pivot <- renderRpivotTable({ rpivotTable(STATUS()) })
if (input$show_margins) { margin_type <- if (input$by_species) "density" else "histogram" p <- p |> ggExtra::ggMarginal( type = margin_type, margins = "both", size = 8, groupColour = input$by_species, groupFill = input$by_species ) } observeEvent(input$diag, { # Criar diretório www se não existir if (!dir.exists("www")) { dir.create("www") }
p }, res = 100 ) diagnose_web_report( STATUS(), output_dir = "www", output_file = "diagnostico.html" )
output$diag_ui <- renderUI({ tags$iframe( src = "diagnostico.html", width = "100%", height = "800px" ) }) })}
shinyApp(ui, server).gitattributes+1
Dockerfile+34-11
STATUS1.xlsxAdded+3
app.R+53-46