Как я могу реорганизовать эту плавную страницу, чтобы увеличить ширину экрана? - PullRequest
1 голос
/ 08 апреля 2020

Я совершенно новичок в Shiny, и я попытался изучить основы, создав это довольно простое приложение. Я пытаюсь понять, как на самом деле работает fluidpage(). Очевидно, я пробовал несколько руководств и т. Д. c., Но выяснил лишь часть из них.

Вопрос: как можно переставить fluidpage() так, чтобы input и output появляются в разных местах моего приложения?

В настоящее время у меня есть

enter image description here

К сожалению, я нахожу оба plots слишком сжатыми, и я хотел бы использовать больше экрана ширина, например, так:

enter image description here

Можно ли это сделать?

Обновление

Я пробовал

ui <- fluidPage(
  titlePanel("Survival Curve of individualized pN-staging\n"),

  fluidRow(column(12), 
           fluidRow(column(3), verbatimTextOutput("out.score"),
                               verbatimTextOutput("out.score.group"),
                    fluidRow(column(3),  sliderInput("n_fjernet", "Lymph Nodal Yield", min = 2, max = 120, value = 40),
                             fluidRow(column(3), sliderInput("n_sygdom", "Number of positive lymph nodes", min = 0, max = 40, value = 0),
                                      fluidRow(column(3), conditionalPanel(
                                        condition = "input.n_sygdom >= 1",
                                        radioButtons("ecs", "Extracapsular extension", c("No","Yes")),
                                        radioButtons("contra.pos", "Neck involvement", c("Contra.","Ipsi.")
                                        )
                                               )))))),

           plotOutput("surv_plot"),
           plotOutput("surv_nom")

)

И похоже, что, безусловно, не все решение

Мой сценарий

library(shiny)
library(survminer)


ui <- fluidPage(
  titlePanel("Survival Curve of individualized pN-staging\n"),
  sidebarLayout(
    sidebarPanel(
      sliderInput("n_fjernet", "Lymph Nodal Yield", min = 2, max = 120, value = 40),
      sliderInput("n_sygdom", "Number of positive lymph nodes", min = 0, max = 40, value = 0),
      conditionalPanel(
        condition = "input.n_sygdom >= 1",
        radioButtons("ecs", "Extracapsular extension", c("No","Yes")),
        radioButtons("contra.pos", "Neck involvement", c("Contra.","Ipsi.")
        )
      ),
      verbatimTextOutput("out.score"),
      verbatimTextOutput("out.score.group")
    ),
    mainPanel(
      plotOutput("surv_plot"),
      plotOutput("surv_nom")
    )
  )
)



server <- function(input, output, session) {

  calc_score <- reactive({
    as.numeric(round(nom$ecs$points[nom$ecs$ecs==input$ecs] +
          nom$contra.pos$points[nom$contra.pos$contra.pos==input$contra.pos] +
          nom$n_fjernet$points[nom$n_fjernet$n_fjernet==input$n_fjernet] +
          nom$n_sygdom$points[nom$n_sygdom$n_sygdom==input$n_sygdom], digits=0))
  })

  observe(
    updateSliderInput(
      session = session,
      inputId = "n_sygdom",
      max = min(40, input$n_fjernet),
      value = min(input$n_fjernet, input$n_sygdom)
    )
  )


  rvs <- reactiveValues(n_sygdom = 0)


  observeEvent(input$n_sygdom, {
    if ((input$n_sygdom >= 1 && rvs$n_sygdom == 0) || (input$n_sygdom == 0)) {
      updateRadioButtons(session, "ecs", selected = "No")
      updateRadioButtons(session, "contra.pos", selected = "Contra.")
    }
    rvs$n_sygdom <- input$n_sygdom
  })

  calc_score_group <- function(score) {
    cut(score, c(0,30,50,70,90,Inf), include.lowest = TRUE, labels = c("1","2","3","4","5"))
  }

  fit_data <- reactive({
    p %>% filter(score.group == as.numeric(calc_score_group(calc_score())))
  })

  fit_model <- reactive({
    survfit(Surv(os.neck, mors) ~ 1, data = fit_data())
  })



  output$out.score <- renderText(calc_score())
  output$out.score.group <- renderText(calc_score_group(calc_score()))

  output$surv_plot <- renderPlot({

    n <- ggsurvplot(
      fit_model(),                     
      data = fit_data(), 
      risk.table = TRUE, 
      pval = F,      
      pval.coord = c(0, 0.25),
      conf.int = T,         
      size=1,                    
      xlim = c(0,60),
      conf.int.alpha=c(0.2),
      break.x.by = 6,    
      xlab="Time in months",
      ylab="Probability of overall survival",
      ggtheme = theme_bw(),             
      surv.median.line = "v",
      ylim=c(0,1),
      palette="#2C77BF",
      tables.theme=theme_bw(),
      legend.title=paste("Score group", calc_score_group(calc_score())),
      surv.scale="percent",
      tables.col="strata",
      risk.table.col = "strata",
      risk.table.y.text = FALSE,
      tables.y.text = FALSE)

    n$table <- n$table + labs(x = NULL, y = NULL)

    n

  })

  output$surv_nom <- renderPlot({

    set.seed(1)
    df <- data.frame(y=sample(1:17,1000, replace=TRUE), x=sample(0:100, 1000, replace=TRUE))

    ggplot(df, aes(x=x, y=y)) +

      scale_y_continuous(breaks = seq(0,17,1), 
                         name="",
                         labels = c("5 yrs, probbility of overall survival","","1 yr, probability of overall survival","","pN-score","","","","Neck Involvement","","Extracapsular Extension","","Number of positive nodes","","Lymph Nodal Yield","","Point","")) +

      scale_x_continuous(breaks = seq(0,100,10),
                         name="",
                         labels=c("","","","","","","","","","","")) 


  })


}

shinyApp(ui, server)

Мои данные

p <- structure(list(contra.pos = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 
1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 2L, 
2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 
1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L), .Label = c("Ipsi.", "Contra."), class = "factor"), ecs = structure(c(1L, 
1L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 2L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 
2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 
1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 
1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 
1L, 2L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 
2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 
1L, 1L, 1L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 2L, 2L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"), 
    n_fjernet = c(22L, 61L, 50L, 47L, 30L, 60L, 82L, 60L, 33L, 
    67L, 35L, 56L, 15L, 37L, 44L, 124L, 41L, 30L, 31L, 35L, 36L, 
    28L, 39L, 54L, 25L, 27L, 69L, 53L, 24L, 33L, 52L, 77L, 51L, 
    7L, 22L, 53L, 26L, 58L, 28L, 83L, 39L, 15L, 37L, 27L, 9L, 
    17L, 32L, 26L, 44L, 52L, 22L, 62L, 53L, 68L, 52L, 38L, 50L, 
    21L, 41L, 74L, 15L, 26L, 36L, 37L, 34L, 22L, 31L, 53L, 13L, 
    44L, 43L, 51L, 20L, 21L, 63L, 40L, 25L, 17L, 43L, 47L, 35L, 
    21L, 4L, 23L, 35L, 50L, 69L, 24L, 38L, 45L, 37L, 35L, 25L, 
    19L, 43L, 19L, 33L, 38L, 50L, 21L, 40L, 100L, 45L, 53L, 41L, 
    7L, 75L, 48L, 20L, 11L, 72L, 37L, 34L, 70L, 20L, 47L, 44L, 
    45L, 48L, 23L, 27L, 24L, 39L, 9L, 34L, 22L, 89L, 40L, 35L, 
    34L, 61L, 28L, 27L, 62L, 47L, 13L, 20L, 9L, 27L, 38L, 44L, 
    15L, 33L, 65L, 31L, 49L, 53L, 15L, 26L, 17L, 24L, 20L, 25L, 
    12L, 34L, 22L, 27L, 14L, 27L, 31L, 26L, 15L, 16L, 30L, 19L, 
    51L, 12L, 33L, 68L, 26L, 20L, 34L, 31L, 7L, 76L, 7L, 24L, 
    36L, 22L, 27L, 35L, 64L, 18L, 38L, 10L, 27L, 26L, 47L, 15L, 
    30L, 30L, 21L, 31L, 14L, 14L, 22L, 28L, 13L, 17L, 16L), n_sygdom = c(1L, 
    2L, 1L, 3L, 1L, 0L, 3L, 0L, 2L, 1L, 4L, 4L, 1L, 0L, 2L, 2L, 
    1L, 0L, 0L, 4L, 0L, 0L, 1L, 1L, 0L, 1L, 4L, 3L, 1L, 0L, 8L, 
    1L, 1L, 1L, 1L, 1L, 0L, 1L, 2L, 1L, 0L, 2L, 1L, 0L, 2L, 0L, 
    3L, 0L, 1L, 1L, 1L, 2L, 0L, 3L, 2L, 1L, 0L, 0L, 0L, 2L, 0L, 
    3L, 0L, 0L, 0L, 1L, 1L, 0L, 0L, 1L, 4L, 0L, 0L, 2L, 2L, 1L, 
    1L, 0L, 0L, 3L, 1L, 6L, 0L, 0L, 0L, 3L, 2L, 2L, 4L, 0L, 3L, 
    27L, 0L, 2L, 1L, 0L, 0L, 1L, 1L, 2L, 2L, 5L, 1L, 0L, 0L, 
    1L, 0L, 5L, 0L, 0L, 2L, 10L, 0L, 6L, 2L, 1L, 2L, 0L, 0L, 
    0L, 0L, 4L, 0L, 0L, 1L, 5L, 2L, 2L, 1L, 2L, 1L, 0L, 0L, 1L, 
    13L, 0L, 1L, 0L, 1L, 0L, 1L, 1L, 0L, 23L, 0L, 2L, 2L, 0L, 
    2L, 0L, 0L, 1L, 1L, 0L, 0L, 0L, 2L, 3L, 1L, 4L, 0L, 1L, 0L, 
    5L, 5L, 4L, 0L, 0L, 4L, 0L, 1L, 1L, 0L, 2L, 5L, 1L, 3L, 6L, 
    1L, 1L, 1L, 0L, 0L, 1L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 0L, 
    1L, 2L, 0L, 1L, 1L, 0L, 0L), score = c(43, 44, 36, 69, 41, 
    22, 59, 22, 52, 31, 79, 73, 57, 29, 49, NA, 38, 31, 30, 62, 
    29, 31, 39, 34, 32, 42, 58, 55, 43, 30, 80, 23, 35, 59, 43, 
    35, 32, 33, 53, 26, 28, 57, 39, 31, 59, 34, 61, 32, 37, 35, 
    43, 55, 24, 51, 46, 39, 25, 33, 27, 40, 35, 74, 29, 29, 29, 
    43, 41, 24, 35, 37, 65, 25, 33, 55, 55, 38, 43, 34, 27, 57, 
    51, 74, 38, 33, 29, 68, 53, 54, 73, 26, 60, 120, 32, 56, 
    38, 34, 30, 34, 36, 55, 50, 48, 32, 24, 27, 48, 18, 80, 33, 
    36, 47, 88, 29, 60, 67, 48, 49, 26, 25, 33, 31, 82, 28, 36, 
    52, 87, 47, 50, 40, 51, 44, 31, 31, 32, 95, 35, 56, 36, 54, 
    28, 49, 45, 30, 89, 30, 47, 46, 35, 54, 34, 32, 44, 54, 36, 
    29, 33, 53, 66, 54, 68, 32, 57, 34, 68, 88, 57, 36, 30, 53, 
    32, 44, 40, 30, 59, 72, 48, 75, 75, 43, 42, 51, 21, 34, 39, 
    58, 31, 32, 48, 35, 31, 31, 39, 30, 46, 57, 33, 53, 58, 34, 
    34), score.group = structure(c(2L, 2L, 2L, 3L, 2L, 1L, 3L, 
    1L, 3L, 2L, 4L, 4L, 3L, 1L, 2L, NA, 2L, 2L, 2L, 3L, 1L, 2L, 
    2L, 2L, 2L, 2L, 3L, 3L, 2L, 1L, 4L, 1L, 2L, 3L, 2L, 2L, 2L, 
    2L, 3L, 1L, 1L, 3L, 2L, 2L, 3L, 2L, 3L, 2L, 2L, 2L, 2L, 3L, 
    1L, 3L, 2L, 2L, 1L, 2L, 1L, 2L, 2L, 4L, 1L, 1L, 1L, 2L, 2L, 
    1L, 2L, 2L, 3L, 1L, 2L, 3L, 3L, 2L, 2L, 2L, 1L, 3L, 3L, 4L, 
    2L, 2L, 1L, 3L, 3L, 3L, 4L, 1L, 3L, 5L, 2L, 3L, 2L, 2L, 1L, 
    2L, 2L, 3L, 2L, 2L, 2L, 1L, 1L, 2L, 1L, 4L, 2L, 2L, 2L, 4L, 
    1L, 3L, 3L, 2L, 2L, 1L, 1L, 2L, 2L, 4L, 1L, 2L, 3L, 4L, 2L, 
    2L, 2L, 3L, 2L, 2L, 2L, 2L, 5L, 2L, 3L, 2L, 3L, 1L, 2L, 2L, 
    1L, 4L, 2L, 2L, 2L, 2L, 3L, 2L, 2L, 2L, 3L, 2L, 1L, 2L, 3L, 
    3L, 3L, 3L, 2L, 3L, 2L, 3L, 4L, 3L, 2L, 1L, 3L, 2L, 2L, 2L, 
    2L, 3L, 4L, 2L, 4L, 4L, 2L, 2L, 3L, 1L, 2L, 2L, 3L, 2L, 2L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 2L, 3L, 3L, 2L, 2L), .Label = c("1", 
    "2", "3", "4", "5"), class = "factor"), os.neck = c(9.6, 
    7, 9.2, 10.5, 7.7, 15.2, 13.5, 16.3, 15.3, 12.1, 12.3, 22.3, 
    15.8, 14.4, 10, 14.5, 8.4, 23.8, 6, 3.8, 19.3, 20.1, 15.5, 
    19.8, 13, 32.9, 9.8, 5.7, 30.8, 2.8, 33.6, 27.5, 27.6, 14.6, 
    29.2, 25.4, 18.4, 5.3, 30.8, 28.5, 14.7, 13.1, 6.6, 26.8, 
    40.7, 11.6, 13.3, 10.4, 9.6, 17.5, 35.8, 35.8, 37.6, 33.2, 
    37, 34.6, 40, 41.3, 24.3, 37.5, 40.9, 24.1, 39.3, 11.2, 39.1, 
    19.8, 38.9, 39.4, 36.3, 48, 29.2, 47.9, 3.7, 24.2, 46.4, 
    49.1, 51, 14.2, 54, 19.9, 50.9, 1.9, 54.2, 13.9, 11.6, 10.1, 
    23.1, 62.8, 12.6, 39, 59.8, 6.8, 60.4, 18.5, 61.8, 58.4, 
    49.5, 64.3, 2.4, 26.5, 58.9, 69.9, 64.7, 55.6, 46.5, 29.6, 
    55.7, 19.7, 7.6, 2.7, 17.8, 10.1, 9.9, 74.2, 57.3, 58.9, 
    27, 34.2, 78.8, 27.2, 83, 76.7, 58.1, 22.2, 14.5, 3.9, 25.9, 
    74.6, 66.8, 70.7, 38.1, 7.7, 74.5, 49.9, 11.1, 88.5, 6.4, 
    79.5, 80.8, 70.8, 12.9, 81.2, 17.4, 30, 94.7, 73.5, 72.5, 
    1.4, 89.7, 62.9, 7.6, 93.3, 5.1, 51.2, 62, 55.3, 44.6, 56.9, 
    94.5, 88.6, 32.5, 11, 16.5, 100, 24.7, 24.5, 5.8, 59.8, 59.8, 
    77.8, 92.8, 49.6, 91.2, 1.2, 18.9, 6.3, 32.5, 72.4, 105.8, 
    1.8, 12.8, 57.6, 59.1, 104.1, 15.5, 117.8, 4.3, 67.6, 19.8, 
    112.5, 53.6, 107, 47.6, 9.5, 53.6, 46.5, 57.3, 18.8, 82, 
    13.7), mors = c(0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 
    0L, 0L, 0L, 1L, 0L, 1L, 0L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 
    1L, 1L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 
    1L, 1L, 0L, 0L, 1L, 0L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
    0L, 0L, 1L, 0L, 0L, 0L, 0L, 1L, 0L, 1L, 0L, 0L, 0L, 0L, 1L, 
    0L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 1L, 1L, 1L, 
    1L, 0L, 1L, 1L, 0L, 1L, 0L, 1L, 0L, 0L, 1L, 0L, 1L, 1L, 0L, 
    0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, 1L, 0L, 
    1L, 1L, 0L, 1L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 0L, 1L, 
    1L, 0L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 1L, 1L, 0L, 1L, 
    1L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 1L, 1L, 0L, 0L, 0L, 0L, 
    1L, 1L, 0L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 1L, 1L, 1L, 
    1L, 0L, 0L, 1L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 0L, 0L, 
    0L, 1L, 1L, 1L, 0L, 0L, 0L, 1L, 0L)), row.names = c(NA, 200L
), class = "data.frame")

И nomogram

nom <- structure(list(structure(list(n_fjernet = c(2, 3, 4, 5, 6, 7, 
8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 
56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 
72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 
88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 
103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 
116, 117, 118, 119, 120), Xbeta = c(`1` = -0.0152562141665504, 
`2` = -0.0228843212498257, `3` = -0.0305124283331009, `4` = -0.0381405354163761, 
`5` = -0.0457686424996513, `6` = -0.0533967495829265, `7` = -0.0610248566662018, 
`8` = -0.068652963749477, `9` = -0.0762810708327522, `10` = -0.0839091779160274, 
`11` = -0.0915372849993026, `12` = -0.0991653920825779, `13` = -0.106793499165853, 
`14` = -0.114421606249128, `15` = -0.122049713332404, `16` = -0.129677820415679, 
`17` = -0.137305927498954, `18` = -0.144934034582229, `19` = -0.152562141665504, 
`20` = -0.16019024874878, `21` = -0.167818355832055, `22` = -0.17544646291533, 
`23` = -0.183074569998605, `24` = -0.19070267708188, `25` = -0.198330784165156, 
`26` = -0.205958891248431, `27` = -0.213586998331706, `28` = -0.221215105414981, 
`29` = -0.228843212498257, `30` = -0.236471319581532, `31` = -0.244099426664807, 
`32` = -0.251727533748082, `33` = -0.259355640831357, `34` = -0.266983747914633, 
`35` = -0.274611854997908, `36` = -0.282239962081183, `37` = -0.289868069164458, 
`38` = -0.297496176247734, `39` = -0.305124283331009, `40` = -0.312752390414284, 
`41` = -0.320380497497559, `42` = -0.328008604580834, `43` = -0.33563671166411, 
`44` = -0.343264818747385, `45` = -0.35089292583066, `46` = -0.358521032913935, 
`47` = -0.366149139997211, `48` = -0.373777247080486, `49` = -0.381405354163761, 
`50` = -0.389033461247036, `51` = -0.396661568330311, `52` = -0.404289675413587, 
`53` = -0.411917782496862, `54` = -0.419545889580137, `55` = -0.427173996663412, 
`56` = -0.434802103746687, `57` = -0.442430210829963, `58` = -0.450058317913238, 
`59` = -0.457686424996513, `60` = -0.465314532079788, `61` = -0.472942639163064, 
`62` = -0.480570746246339, `63` = -0.488198853329614, `64` = -0.495826960412889, 
`65` = -0.503455067496165, `66` = -0.51108317457944, `67` = -0.518711281662715, 
`68` = -0.52633938874599, `69` = -0.533967495829265, `70` = -0.541595602912541, 
`71` = -0.549223709995816, `72` = -0.556851817079091, `73` = -0.564479924162366, 
`74` = -0.572108031245641, `75` = -0.579736138328917, `76` = -0.587364245412192, 
`77` = -0.594992352495467, `78` = -0.602620459578742, `79` = -0.610248566662018, 
`80` = -0.617876673745293, `81` = -0.625504780828568, `82` = -0.633132887911843, 
`83` = -0.640760994995118, `84` = -0.648389102078394, `85` = -0.656017209161669, 
`86` = -0.663645316244944, `87` = -0.671273423328219, `88` = -0.678901530411494, 
`89` = -0.68652963749477, `90` = -0.694157744578045, `91` = -0.70178585166132, 
`92` = -0.709413958744595, `93` = -0.717042065827871, `94` = -0.724670172911146, 
`95` = -0.732298279994421, `96` = -0.739926387077696, `97` = -0.747554494160972, 
`98` = -0.755182601244247, `99` = -0.762810708327522, `100` = -0.770438815410797, 
`101` = -0.778066922494072, `102` = -0.785695029577348, `103` = -0.793323136660623, 
`104` = -0.800951243743898, `105` = -0.808579350827173, `106` = -0.816207457910448, 
`107` = -0.823835564993724, `108` = -0.831463672076999, `109` = -0.839091779160274, 
`110` = -0.846719886243549, `111` = -0.854347993326825, `112` = -0.8619761004101, 
`113` = -0.869604207493375, `114` = -0.87723231457665, `115` = -0.884860421659926, 
`116` = -0.892488528743201, `117` = -0.900116635826476, `118` = -0.907744742909751, 
`119` = -0.915372849993026), points = c(`1` = 33.2720778855054, 
`2` = 32.9901111237639, `3` = 32.7081443620223, `4` = 32.4261776002807, 
`5` = 32.1442108385391, `6` = 31.8622440767976, `7` = 31.580277315056, 
`8` = 31.2983105533144, `9` = 31.0163437915729, `10` = 30.7343770298313, 
`11` = 30.4524102680897, `12` = 30.1704435063481, `13` = 29.8884767446066, 
`14` = 29.606509982865, `15` = 29.3245432211234, `16` = 29.0425764593819, 
`17` = 28.7606096976403, `18` = 28.4786429358987, `19` = 28.1966761741571, 
`20` = 27.9147094124156, `21` = 27.632742650674, `22` = 27.3507758889324, 
`23` = 27.0688091271909, `24` = 26.7868423654493, `25` = 26.5048756037077, 
`26` = 26.2229088419661, `27` = 25.9409420802246, `28` = 25.658975318483, 
`29` = 25.3770085567414, `30` = 25.0950417949999, `31` = 24.8130750332583, 
`32` = 24.5311082715167, `33` = 24.2491415097751, `34` = 23.9671747480336, 
`35` = 23.685207986292, `36` = 23.4032412245504, `37` = 23.1212744628089, 
`38` = 22.8393077010673, `39` = 22.5573409393257, `40` = 22.2753741775841, 
`41` = 21.9934074158426, `42` = 21.711440654101, `43` = 21.4294738923594, 
`44` = 21.1475071306179, `45` = 20.8655403688763, `46` = 20.5835736071347, 
`47` = 20.3016068453931, `48` = 20.0196400836516, `49` = 19.73767332191, 
`50` = 19.4557065601684, `51` = 19.1737397984269, `52` = 18.8917730366853, 
`53` = 18.6098062749437, `54` = 18.3278395132021, `55` = 18.0458727514606, 
`56` = 17.763905989719, `57` = 17.4819392279774, `58` = 17.1999724662359, 
`59` = 16.9180057044943, `60` = 16.6360389427527, `61` = 16.3540721810111, 
`62` = 16.0721054192696, `63` = 15.790138657528, `64` = 15.5081718957864, 
`65` = 15.2262051340449, `66` = 14.9442383723033, `67` = 14.6622716105617, 
`68` = 14.3803048488201, `69` = 14.0983380870786, `70` = 13.816371325337, 
`71` = 13.5344045635954, `72` = 13.2524378018539, `73` = 12.9704710401123, 
`74` = 12.6885042783707, `75` = 12.4065375166291, `76` = 12.1245707548876, 
`77` = 11.842603993146, `78` = 11.5606372314044, `79` = 11.2786704696629, 
`80` = 10.9967037079213, `81` = 10.7147369461797, `82` = 10.4327701844381, 
`83` = 10.1508034226966, `84` = 9.868836660955, `85` = 9.58686989921343, 
`86` = 9.30490313747186, `87` = 9.02293637573029, `88` = 8.74096961398872, 
`89` = 8.45900285224714, `90` = 8.17703609050557, `91` = 7.895069328764, 
`92` = 7.61310256702243, `93` = 7.33113580528086, `94` = 7.04916904353929, 
`95` = 6.76720228179771, `96` = 6.48523552005614, `97` = 6.20326875831457, 
`98` = 5.921301996573, `99` = 5.63933523483143, `100` = 5.35736847308986, 
`101` = 5.07540171134829, `102` = 4.79343494960672, `103` = 4.51146818786514, 
`104` = 4.22950142612357, `105` = 3.947534664382, `106` = 3.66556790264043, 
`107` = 3.38360114089886, `108` = 3.10163437915729, `109` = 2.81966761741572, 
`110` = 2.53770085567415, `111` = 2.25573409393257, `112` = 1.973767332191, 
`113` = 1.69180057044943, `114` = 1.40983380870786, `115` = 1.12786704696629, 
`116` = 0.845900285224714, `117` = 0.563933523483143, `118` = 0.281966761741571, 
`119` = 0)), info = list(nfun = 3L, predictor = "n_fjernet", 
    effect.name = "n_fjernet", type = "main")), structure(list(
    n_sygdom = c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 
    14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 
    29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40), Xbeta = c(`120` = 0, 
    `121` = 0.289782888103146, `122` = 0.597659631547995, `123` = 0.847429207013489, 
    `124` = 1.02887445686286, `125` = 1.15566024621933, `126` = 1.24145144020613, 
    `127` = 1.29991290394648, `128` = 1.3447095025636, `129` = 1.38722862366018, 
    `130` = 1.42974774475677, `131` = 1.47226686585336, `132` = 1.51478598694994, 
    `133` = 1.55730510804654, `134` = 1.59982422914312, `135` = 1.64234335023972, 
    `136` = 1.6848624713363, `137` = 1.72738159243285, `138` = 1.76990071352946, 
    `139` = 1.81241983462605, `140` = 1.85493895572266, `141` = 1.89745807681922, 
    `142` = 1.93997719791581, `143` = 1.98249631901238, `144` = 2.02501544010901, 
    `145` = 2.06753456120562, `146` = 2.11005368230218, `147` = 2.15257280339881, 
    `148` = 2.19509192449543, `149` = 2.23761104559199, `150` = 2.2801301666886, 
    `151` = 2.32264928778508, `152` = 2.36516840888183, `153` = 2.40768752997815, 
    `154` = 2.45020665107478, `155` = 2.49272577217142, `156` = 2.53524489326801, 
    `157` = 2.57776401436475, `158` = 2.62028313546134, `159` = 2.66280225655792, 
    `160` = 2.70532137765463), points = c(`120` = 0, `121` = 10.7115882976674, 
    `122` = 22.0920012122972, `123` = 31.3245300175082, `124` = 38.0315058078179, 
    `125` = 42.7180391862067, `126` = 45.8892407556548, `127` = 48.0502211191424, 
    `128` = 49.7060908796498, `129` = 51.2777755396602, `130` = 52.8494601996709, 
    `131` = 54.4211448596817, `132` = 55.9928295196922, `133` = 57.5645141797031, 
    `134` = 59.1361988397135, `135` = 60.7078834997246, `136` = 62.2795681597352, 
    `137` = 63.8512528197446, `138` = 65.422937479756, `139` = 66.9946221397666, 
    `140` = 68.5663067997782, `141` = 70.1379914597879, `142` = 71.7096761197985, 
    `143` = 73.2813607798086, `144` = 74.8530454398212, `145` = 76.4247300998324, 
    `146` = 77.9964147598421, `147` = 79.5680994198545, `148` = 81.1397840798663, 
    `149` = 82.7114687398759, `150` = 84.2831533998875, `151` = 85.8548380598941, 
    `152` = 87.4265227199109, `153` = 88.9982073799118, `154` = 90.5698920399238, 
    `155` = 92.1415766999367, `156` = 93.7132613599473, `157` = 95.2849460199637, 
    `158` = 96.8566306799743, `159` = 98.428315339985, `160` = 100
    )), info = list(nfun = 3L, predictor = "n_sygdom", effect.name = "n_sygdom", 
    type = "main")), structure(list(ecs = c("No", "Yes"), Xbeta = c(`161` = 0, 
`162` = 0.311111953690113), points = c(`161` = 0, `162` = 11.4999998247835
)), info = list(nfun = 3L, predictor = "ecs", effect.name = "ecs", 
    type = "main")), structure(list(contra.pos = c("Ipsi.", "Contra."
), Xbeta = c(`163` = 0, `164` = -0.139442361056046), points = c(`163` = 5.15437323668122, 
`164` = 0)), info = list(nfun = 3L, predictor = "contra.pos", 
    effect.name = "contra.pos", type = "main")), list(x = c(0, 
10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140)), 
    list(x = c(-8.14452801469555, 10.3375645059895, 28.8196570266746, 
    47.3017495473596, 65.7838420680447, 84.2659345887298, 102.748027109415, 
    121.2301196301, 139.712212150785), x.real = c(-1.5, -1, -0.5, 
    0, 0.5, 1, 1.5, 2, 2.5)), list(x = c(133.253056210811, 122.523862453927, 
    112.430840978251, 102.114459495373, 90.8324450279162, 77.5548046068363, 
    60.2182329183346, 32.4792532034398), x.real = c(0.2, 0.3, 
    0.4, 0.5, 0.6, 0.7, 0.8, 0.9), fat = c("0.2", "0.3", "0.4", 
    "0.5", "0.6", "0.7", "0.8", "0.9"), which = c(FALSE, TRUE, 
    TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)), list(x = c(112.024963827927, 
    98.7863551985778, 88.0571515041272, 77.9641378681437, 67.6477499654811, 
    56.3657514459693, 43.0880807889333, 25.7515453011765, -1.98744879901151
    ), x.real = c(0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9
    ), fat = c("0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", 
    "0.8", "0.9"), which = c(FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, 
    TRUE, TRUE, TRUE, TRUE, FALSE)), list(x = c(97.0648415571574, 
    83.8262076192369, 73.0970097888707, 63.0039908791831, 52.6876103537277, 
    41.4055979851762, 28.1279463383259, 10.7913911577688), x.real = c(0.1, 
    0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8), fat = c("0.1", "0.2", 
    "0.3", "0.4", "0.5", "0.6", "0.7", "0.8"), which = c(FALSE, 
    TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE))), .Names = c("n_fjernet", 
"n_sygdom", "ecs", "contra.pos", "total.points", "lp", "Probability of 1 year survival", 
"Probability of 5 years survival", NA), info = list(fun = list(
    function (x) 
    surv(12, x), function (x) 
    surv(36, x), function (x) 
    surv(60, x)), lp = TRUE, lp.at = c(-1.5, -1, -0.5, 0, 0.5, 
1, 1.5, 2, 2.5), discrete = c(n_fjernet = FALSE, n_sygdom = FALSE, 
ecs = TRUE, contra.pos = TRUE, studie = TRUE), funlabel = c("Probability of 1 year survival", 
"Probability of 5 years survival"), fun.at = NULL, fun.lp.at = NULL, 
    Abbrev = list(), minlength = 4, conf.int = FALSE, R = structure(c(-0.915372849993026, 
    -0.0152562141665504, 0, 2.70532137765463, 0, 0.311111953690113, 
    -0.139442361056046, 0), .Dim = c(2L, 4L), .Dimnames = list(
        NULL, c("n_fjernet", "n_sygdom", "ecs", "contra.pos"))), 
    sc = 36.9641850413701, maxscale = 100, Intercept = -1.27966434250937, 
    nint = 10, space.used = c(main = 4, ia = 0)), class = "nomogram")

1 Ответ

2 голосов
/ 09 апреля 2020

Конечно, FluidRow может сделать это для нас. Использование wellpanel дает отчетливый вид, который вам нужен.

enter image description here

library(shiny)

ui <- fluidPage(

    titlePanel("Survival Curve of individualized pN-staging\n"),
    br(),

    #Row of Inputs (make sure the columns sum to 12)
    fluidRow(

        column(3,
            wellPanel(style = "height:150px", sliderInput("n_fjernet1", "Lymph Nodal Yield", min = 2, max = 120, value = 40))
        ),

        column(3,
            wellPanel(style = "height:150px", sliderInput("n_sygdom", "Number of positive lymph nodes", min = 0, max = 40, value = 0))
        ),

        column(3,
            wellPanel(style = "height:150px", radioButtons("ecs", "Extracapsular extension", c("No","Yes")))
        ),

        column(3,
            wellPanel(style = "height:150px", radioButtons("contra.pos", "Neck involvement", c("Contra.","Ipsi.")))
        )

    ),
    br(),

    #Row of Outputs (make sure the columns sum to 12)
    fluidRow(

        column(6,
            plotOutput('plot_1')
        ),

        column(6,
            plotOutput('plot_2')
        )

    )

)

server <- function(input, output, session) {

    output$plot_1 <- renderPlot({
        hist(runif(100))
    })

    output$plot_2 <- renderPlot({
        hist(runif(100))
    })

}

shinyApp(ui, server)
...