title: Different sidebars with different input widgets for different pages in flexdashboard
body: <p>Below is an app I am trying to make using flexdashboard, which consists of multiple pages.(Right now making second page which is called CH2)</p>
  <pre><code>---
  title: &quot;Financial TS Analysis&quot;
  runtime: shiny
  output: 
    flexdashboard::flex_dashboard:
      orientation: rows
      vertical_layout: fill
      smooth_scroll: true
      
      theme: simplex
  ---
  
  
  ```{r setup, include=FALSE}
  library(flexdashboard)
  library(fBasics)
  library(FinTS)
  library(tidyquant)
  library(shiny)
  library(quantmod)
  library(ggplot2)
  library(highcharter)
  library(shinyjs)
  library(htmltools)
  scroll_css = &quot;&lt;style&gt; #section-text {overflow-y: scroll;}&lt;/style&gt;&quot;
  ```
  
  Sidebar {.sidebar}
  =========================================
  ```{r echo=FALSE}
  tags$h5(&quot;Please click the submit button after every input change&quot;)
  tags$hr()
  
  textInput(&quot;tickers&quot;,&quot;Ticker&quot;,value = &quot;&quot;,placeholder = &quot;tickers&quot;)
  dateInput(&quot;from&quot;,&quot;Starting Date&quot;,format = &quot;yyyy-mm-dd&quot;)
  sliderInput(&quot;k&quot;,&quot;Number of Period&quot;,min = 0,max = 250,value = 10)
  checkboxGroupInput(&quot;priceKind&quot;,&quot;Kind (Choose 1)&quot;,c(&quot;Open&quot;,&quot;High&quot;,&quot;Low&quot;,&quot;Close&quot;),selected = &quot;Close&quot;,inline = TRUE)
  # Close = Adjusted
  kind = c(&quot;Open&quot;,&quot;High&quot;,&quot;Low&quot;,&quot;Close&quot;)
  kindIndex = c(1,2,3,4)
  names(kindIndex) = kind
  
  numericInput(&quot;x&quot;,&quot;Initial Investment in $&quot;,value = 0)
  sliderInput(&quot;m&quot;,&quot;Number of Periods of Interest Payment per annum&quot;,min = 1,max = 365,value = 2)
  sliderInput(&quot;r&quot;,&quot;Interest year per annum&quot;,min = 0,max = 1,value = 0.05)
  
  actionButton(&quot;go&quot;,&quot;Submit&quot;)
  ```
  
  CH 1
  =========================================
  
  Row {data-height=300}
  -----------------------------------------
  
  ```{css my-style, echo=FALSE}
  #section-notes-and-formulas
    .chart-stage-flex {
      overflow-y: scroll;
    }
  ```
  
  
  ### Notes and Formulas
  ```{r}
  htmltools::includeMarkdown('Notes.Rmd')
  ```
   
  
  
  Row {.tabset .tabset-fade}
  ---------------------------------------------
  
  ### Price 
  ```{r}
  ## Data retrieval based on starting date and tickers
  data = eventReactive(input$go,{
    data = getSymbols(Symbols = input$tickers,src = &quot;yahoo&quot;,from = input$from,to = Sys.Date(),auto.assign = FALSE)
    data =data[,kindIndex[input$priceKind]]
    data
  })
  
  ## Showing data
  renderHighchart({
    data = data()
    highchart(type=&quot;stock&quot;) %&gt;% hc_title(text = paste(&quot;price of &quot;,input$tickers,sep = &quot;&quot;)) %&gt;% 
      hc_add_series(data,name=&quot;Price&quot;,color=&quot;blue&quot;) %&gt;% 
      hc_navigator(enabled=TRUE) %&gt;% 
      hc_scrollbar(enabled=TRUE) %&gt;% 
      hc_exporting(enabled=TRUE) %&gt;% 
      hc_chart(zoomType = &quot;xy&quot;)
  })
  ```
  
  
  ### Return (1)
  ```{r}
  get_One_Period_Simple_Return = function(price){
    n = length(price)
    Return = (price[2:n]/price[1:(n-1)])
    return(Return)
  }
  
  renderHighchart({
    data = data()
    data = as.xts(apply(data,2,get_One_Period_Simple_Return))
    highchart(type=&quot;stock&quot;) %&gt;% hc_title(text = paste(&quot;One-Period Simple Return of &quot;,input$tickers,sep = &quot;&quot;)) %&gt;% 
      hc_add_series(data,name=&quot;Return&quot;,color=&quot;blue&quot;) %&gt;% 
      hc_navigator(enabled=TRUE) %&gt;% 
      hc_scrollbar(enabled=TRUE) %&gt;% 
      hc_exporting(enabled=TRUE) %&gt;% 
      hc_chart(zoomType = &quot;xy&quot;)
  })
  ```
  
  ### Return (2)
  ```{r}
  get_One_Period_Simple_Net_Return = function(price){
    n = length(price)
    Return = (price[2:n]/price[1:(n-1)]) - 1
    return(Return)
  }
  
  renderHighchart({
    data = data()
    data = as.xts(apply(data,2,get_One_Period_Simple_Net_Return))
    highchart(type=&quot;stock&quot;) %&gt;% hc_title(text = paste(&quot;One-Period Simple Net Return of &quot;,input$tickers,sep=&quot;&quot;)) %&gt;% 
      hc_add_series(data,name=&quot;Return&quot;,color=&quot;blue&quot;) %&gt;% 
      hc_navigator(enabled=TRUE) %&gt;% 
      hc_scrollbar(enabled=TRUE) %&gt;% 
      hc_exporting(enabled=TRUE) %&gt;% 
      hc_chart(zoomType = &quot;xy&quot;)
  })
  ```
  
  ### Return (3)
  ```{r}
  get_multi_Period_Simple_Return = function(price,k){
    n = length(price)
    Return = (price[k:n]/price[1:(n-k)])
    return(Return)
  }
  
  renderHighchart({
    data = data()
    data = as.xts(apply(data,2,get_multi_Period_Simple_Return,input$k))
    highchart(type=&quot;stock&quot;) %&gt;% hc_title(text = paste(&quot;Multiperiod Simple Gross Return of &quot;,input$tickers,sep=&quot;&quot;)) %&gt;% 
      hc_add_series(data,name=&quot;Return&quot;,color=&quot;blue&quot;) %&gt;% 
      hc_navigator(enabled=TRUE) %&gt;% 
      hc_scrollbar(enabled=TRUE) %&gt;% 
      hc_exporting(enabled=TRUE) %&gt;% 
      hc_chart(zoomType = &quot;xy&quot;)
  })
  ```
  
  
  ### Return (4)
  ```{r}
  get_multi_Period_Simple_Return = function(price,k){
    n = length(price)
    Return = (price[k:n]-price[1:(n-k)])/price[1:(n-k)]
    return(Return)
  }
  
  renderHighchart({
    data = data()
    data = as.xts(apply(data,2,get_multi_Period_Simple_Return,input$k))
    highchart(type=&quot;stock&quot;) %&gt;% hc_title(text = paste(&quot;k-period Simple Net Return of &quot;,input$tickers,sep=&quot;&quot;)) %&gt;% 
      hc_add_series(data,name=&quot;Return&quot;,color=&quot;blue&quot;) %&gt;% 
      hc_navigator(enabled=TRUE) %&gt;% 
      hc_scrollbar(enabled=TRUE) %&gt;% 
      hc_exporting(enabled=TRUE) %&gt;% 
      hc_chart(zoomType = &quot;xy&quot;)
  })
  ```
  
  
  ### Return (5)
  ```{r}
  get_multi_Period_Simple_Return = function(price,k){
    n = length(price)
    Return = ((price[k:n]/price[1:(n-k)]))^(1/k) -1
    return(Return)
  }
  
  renderHighchart({
    data = data()
    data = as.xts(apply(data,2,get_multi_Period_Simple_Return,input$k))
    highchart(type=&quot;stock&quot;) %&gt;% hc_title(text = paste(&quot;Annualized Return of &quot;,input$tickers,sep=&quot;&quot;)) %&gt;% 
      hc_add_series(data,name=&quot;Return&quot;,color=&quot;blue&quot;) %&gt;% 
      hc_navigator(enabled=TRUE) %&gt;% 
      hc_scrollbar(enabled=TRUE) %&gt;% 
      hc_exporting(enabled=TRUE) %&gt;% 
      hc_chart(zoomType = &quot;xy&quot;)
  })
  ```
  
  
  ### Compounding Effect (6)
  ```{r}
  compounder = function(C,m,r) {
    values = c()
    for (i in 1:m) {
      val = C*(1+r/i)^i
      values = c(values,val)
      
    }
    t = 1:m
    names(values) = t
    return(values)
  }
  
  renderPlot({
    data = compounder(input$x,input$m,input$r)
      plot(1:input$m,data,xlab = &quot;period&quot;,ylab = &quot;value&quot;,main=paste(&quot;growth of &quot;,input$x,&quot;$ principal when r = &quot;,input$r,&quot; and number of compounding period is &quot;,input$m,sep=&quot;&quot;))
      
  })
  ```
  
  ### Return (7)
  ```{r}
  log_return = function(price){
    n = length(price)
    Return = log(price[2:n]/price[1:(n-1)])
    return(Return)
  }
  
  renderHighchart({
    data = data()
    data = as.xts(apply(data,2,log_return))
    highchart(type=&quot;stock&quot;) %&gt;% hc_title(text = paste(&quot;Log Return of &quot;,input$tickers,sep = &quot;&quot;)) %&gt;% 
      hc_add_series(data,name=&quot;Return&quot;,color=&quot;blue&quot;) %&gt;% 
      hc_navigator(enabled=TRUE) %&gt;% 
      hc_scrollbar(enabled=TRUE) %&gt;% 
      hc_exporting(enabled=TRUE) %&gt;% 
      hc_chart(zoomType = &quot;xy&quot;)
  })
  ```
  
  ### Basic Statistics of Return in \%
  ```{r}
  returns = eventReactive(input$go,{
    data = data()
    returns = apply(data,2,get_One_Period_Simple_Net_Return)*100
    returns
  })
  
  renderTable({basicStats(returns())},rownames = TRUE,border = TRUE,striped = TRUE,hover = TRUE)
  ```
  
  ### t-test (log returns)
  ```{r}
  logR = eventReactive(input$go,{
    data = data()
    returns = apply(data,2,log_return)*100
    returns
  })
  
  renderPrint({t.test(logR())})
  ```
  
  ### Normality Test (JB)
  ```{r}
  renderPrint({normalTest(logR(),method='jb')})
  ```
  
  CH2
  ============================================
  </code></pre>
  <p>what I am wondering is how can I have a sidebar with different input widgets for my second page(CH2). as you can see I have a sidebar for first page (CH1) but want a different sidebar just for second page.</p>