library(shiny)
library(tidyverse)
library(ISLR)
library(glmnet)
library(dplyr)
library(tidyr)
metadata <- readRDS("merging2.rds")
ui <- fluidPage( titlePanel("BLCA-GENE EXPRESSION"),
sidebarPanel(
selectInput(
inputId = "gene",
label = "Please choose a gene",
choices = c(
"ENSG00000000003.15"="ENSG00000000003.15",
"ENSG00000000005.6"="ENSG00000000005.6",
"ENSG00000000419.13"="ENSG00000000419.13",
"ENSG00000000457.14"="ENSG00000000457.14",
"ENSG00000000460.17"="ENSG00000000460.17",
"ENSG00000000938.13"="ENSG00000000938.13",
"ENSG00000000971.16"="ENSG00000000971.16",
"ENSG00000001036.14"="ENSG00000001036.14",
"ENSG00000001084.13"="ENSG00000001084.13",
"ENSG00000001167.14"="ENSG00000001167.14",
"ENSG00000001460.18"="ENSG00000001460.18",
"ENSG00000001461.17"="ENSG00000001461.17",
"ENSG00000001497.18"="ENSG00000001497.18",
"ENSG00000001561.7"="ENSG00000001561.7",
"ENSG00000001617.12"="ENSG00000001617.12",
"ENSG00000001626.16"="ENSG00000001626.16",
"ENSG00000001629.10"="ENSG00000001629.10",
"ENSG00000001630.17"="ENSG00000001630.17",
"ENSG00000001631.16"="ENSG00000001631.16",
"ENSG00000002016.18"="ENSG00000002016.18",
"ENSG00000002079.14"="ENSG00000002079.14",
"ENSG00000002330.14"="ENSG00000002330.14",
"ENSG00000002549.12"="ENSG00000002549.12",
"ENSG00000002586.20"="ENSG00000002586.20",
"ENSG00000002586.20_PAR_Y"="ENSG00000002586.20_PAR_Y",
"ENSG00000002587.10"="ENSG00000002587.10",
"ENSG00000002726.21"="ENSG00000002726.21",
"ENSG00000002745.13"="ENSG00000002745.13",
"ENSG00000002746.15"="ENSG00000002746.15",
"ENSG00000002822.15"="ENSG00000002822.15",
"ENSG00000002834.18"="ENSG00000002834.18",
"ENSG00000002919.15"= "ENSG00000002919.15",
"ENSG00000002933.9"="ENSG00000002933.9",
"ENSG00000003056.8"="ENSG00000003056.8",
"ENSG00000003096.14"="ENSG00000003096.14",
"ENSG00000003137.8"= "ENSG00000003137.8",
"ENSG00000003147.19"="ENSG00000003147.19",
"ENSG00000003249.15"="ENSG00000003249.15",
"ENSG00000003393.15"= "ENSG00000003393.15",
"ENSG00000003400.15"="ENSG00000003400.15",
"ENSG00000003402.20"="ENSG00000003402.20",
"ENSG00000003436.16"= "ENSG00000003436.16",
"ENSG00000003509.16"="ENSG00000003509.16",
"ENSG00000003756.17"="ENSG00000003756.17",
"ENSG00000003987.14"="ENSG00000003987.14",
"ENSG00000003989.18"="ENSG00000003989.18",
"ENSG00000004059.11"= "ENSG00000004059.11",
"ENSG00000004139.14"="ENSG00000004139.14",
"ENSG00000004142.12"="ENSG00000004142.12" ),
selected = ""),
radioButtons(
inputId="choices",
label = "Please choose one of the below choices",
choices = c("lasso"="lasso",
"ridge"="ridge"),
plotOutput(outputId = "hist")
)
)
)
server <- function(input,output) {
plotOutput$hist <- renderPlot({
newx <- data.matrix(metadata[1:20,1:2])
newy <- metadata$ENSG00000000003.15[1:20]
library(glmnet)
#perform k-fold cross-validation to find optimal lambda value
dataa_shiny == cv.glmnet(newx, newy, alpha = 1)
#find optimal lambda value that minimizes test MSE
plot_shiny <- dataa_shiny$lambda.min
#produce plot of test MSE by lambda value
plot(dataa_shiny) })}
shinyApp(ui=ui, server=server)
but there is a error like
Error in plotOutput$hist <- renderPlot({ :
object of type 'closure' is not subsettable
Thank you so much...