Income & Voting


What is the relationship between socioeconomic status (income/education) and voting? Gelman et al. (2007) show that answer to this question depends on where you live..

“..income matters more in red America than in blue America. In poor states, rich people are much more likely than poor people to vote for the Republican presidential candidate, but in rich states (such as Connecticut), income has a very low correlation with vote preference..”

This section visualizes some ideas presented in Gelman’s popular book using ANES (1948-2012) and county election outcomes.

1. Income & Voting

Rich States vote Blue, Poor States vote Red

# Remove DC, HI, & Alaska. Missing values and outliers in many domains. 
election<-na.omit(election)
scatterD3(x = election$Median_income, y = election$Per_Obama12, lab = election$STATE,
              col_var = election$Red_Blue, size_var= election$Population_Mil, size_range = c(1,500), point_opacity = 0.7, ellipses = TRUE,  size_lab = "Population Mil",axes_font_size = "120%",
              xlab = "Median Income", ylab = "% Obama Votes", col_lab = "Red Blue States",
              colors = c("Red" =  "#f03b20", "Blue" = "#3182bd"), lasso = TRUE,
              width = 800,
              height = 600)



2. ANES

The data used in this analysis is from the American National Election Studies (ANES Time Series, 1948-2012). Data can be downloaded here.

Note: All analysis here uses sampling weights (VCF0009 in data) to replicate official numbers reported on ANES web page.

Voting Over Time


yr<-group_by( a1, year)%>%
  summarise(Per_Rep = round(weighted.mean(VoteR, Weight, na.rm = TRUE)*100) )%>%
  mutate(Per_Dem=100-Per_Rep)

datatable(yr, colnames = c('% Voted for Republican' = 'Per_Rep', '% Voted for Democrat' = 'Per_Dem'),
          extensions = 'Buttons', height = 300, options = list(
            dom = 'Bfrtip', 
            buttons = c('copy', 'csv', 'excel', 'pdf', 'print')),
          caption = 'Table 1: Vote Share (1948--2012), Source: ANES ')%>%
  formatStyle('% Voted for Republican',  color = c("Red"),  fontWeight = 'bold')%>%
  formatStyle('% Voted for Democrat',  color = c("Blue"),  fontWeight = 'bold')



# Plot

v1<-highchart() %>%
  hc_chart(type = "line")%>%
  hc_xAxis(categories = yr$year,  
           plotBands = list(
             list(from = 0, to = 1, color = "rgba(0,0,100,0.1)", label = list(
               text = "Truman", verticalAlign = "bottom",
               style = list(color = "black"), textAlign = "center", rotation = 0, y = -5)), 
             list(from = 1, to = 3, color = "rgba(100, 0, 0, 0.1)", label = list(
               text = "Eisenhover", verticalAlign = "bottom",
               style = list(color = "#606060"), textAlign = "center", rotation = 0, y = -5)), 
             list(from = 3, to = 5, color = "rgba(0,0,100,0.1)", label = list(
               text = "Kennedy/LBJ", verticalAlign = "bottom",
               style = list(color = "#606060"), textAlign = "center", rotation = 0, y = -5)),
             list(from = 5, to = 7, color = "rgba(100, 0, 0, 0.1)",label = list(
               text = "Nixon/Ford", verticalAlign = "bottom",
               style = list(color = "#606060"), textAlign = "center", rotation = 0, y = -5)),
             list(from = 7, to = 8, color = "rgba(0,0,100,0.1)",label = list(
               text = "Carter", verticalAlign = "bottom",
               style = list(color = "#606060"), textAlign = "center", rotation = 0, y = -5)),
             list(from = 8, to = 11, color = "rgba(100, 0, 0, 0.1)",label = list(
               text = "Reagan/Bush1", verticalAlign = "bottom",
               style = list(color = "#606060"), textAlign = "center", rotation = 0, y = -5)),
             list(from = 11, to = 13, color = "rgba(0,0,100,0.1)",label = list(
               text = "Clinton", verticalAlign = "bottom",
               style = list(color = "#606060"), textAlign = "center", rotation = 0, y = -5)),
             list(from = 13, to = 15, color = "rgba(100, 0, 0, 0.1)",label = list(
               text = "Bush2", verticalAlign = "bottom",
               style = list(color = "#606060"), textAlign = "center", rotation = 0, y = -5)),
             list(from = 15, to = 18, color = "rgba(0,0,100,0.1)", label = list(
               text = "Obama", verticalAlign = "bottom",
               style = list(color = "#606060"), textAlign = "center", rotation = 0, y = -5)))) %>%
  
  hc_add_series(name = "Voted Republican", data = yr$Per_Rep, dataLabels = list(enabled = TRUE)) %>%
  hc_add_series(name = "Voted Democrat", data = yr$Per_Dem, dataLabels = list(enabled = TRUE)) %>%
  hc_colors(c( "Red" , "#1E90FF"))%>%
  hc_title(text = "Presidential Vote Share (1948--2012)") %>%
  hc_subtitle(text = "Source: American National Election Studies (ANES)")%>%
  hc_tooltip(crosshairs = list(enabled=TRUE, color="#CDC673"),valueSuffix="%", backgroundColor = "#f0f0f0",
             shared = TRUE, borderWidth = .1) %>%
  hc_yAxis(title = list(text = "% who voted for Dem vs. Rep Presidential candidate"),
           labels = list(format = "{value}%"))   %>%
  hc_exporting(enabled = TRUE)

hw_grid (v1, rowheight = 600)



Vote Share

Income

yr1<-   group_by( a1, year, Income)%>%
  summarise(No.of.Obs = n(),Per_Republican= round(weighted.mean(VoteR, Weight, na.rm = TRUE)*100))%>%
  mutate(  Per_Democrat = 100-Per_Republican)
yr1<-na.omit(yr1)

thm<- hc_theme_tufte2()


yr<-filter (yr1, Income=="0 to 16 percentile")

low<-highchart() %>%
  hc_chart(type = "line")%>%
  hc_xAxis(categories = yr$year) %>%
  hc_add_series(name = "% Voted Democrat", data = yr$Per_Democrat, dataLabels = list(enabled = FALSE)) %>%
  hc_add_series(name = "% Voted Republican", data = yr$Per_Republican, dataLabels = list(enabled = FALSE)) %>%
  hc_colors(c("#1E90FF", "Red" ))%>%
  hc_title(text = "0 to 16 percentile") %>%
  hc_tooltip(
    crosshairs = list(enabled=TRUE, color="#CDC673"), backgroundColor = "#f0f0f0",
    shared = TRUE, borderWidth = 1) %>%
  hc_yAxis(labels = list(format = "{value}%"), min= 10,  max= 90)  %>%
  hc_exporting(enabled = FALSE) %>%
  hc_add_theme(thm)


yr<-filter (yr1, Income=="17 to 33 percentile")
mid<-highchart() %>%
  hc_chart(type = "line")%>%
  hc_xAxis(categories = yr$year) %>%
  hc_add_series(name = "% Voted Democrat", data = yr$Per_Democrat, dataLabels = list(enabled = FALSE)) %>%
  hc_add_series(name = "% Voted Republican", data = yr$Per_Republican, dataLabels = list(enabled = FALSE)) %>%
  hc_colors(c("#1E90FF", "Red" ))%>%
  hc_title(text = "17 to 33 percentile") %>%
  hc_tooltip(
    crosshairs = list(enabled=TRUE, color="#CDC673"), backgroundColor = "#f0f0f0",
    shared = TRUE, borderWidth = 1) %>%
  hc_yAxis(labels = list(format = "{value}%"),min= 10,  max= 90)  %>%
  hc_exporting(enabled = FALSE) %>%
  hc_add_theme(thm)



yr<-filter (yr1, Income=="34 to 67 percentile")
high<-  highchart() %>%
  hc_chart(type = "line")%>%
  hc_xAxis(categories = yr$year) %>%
  hc_add_series(name = "% Voted Democrat", data = yr$Per_Democrat, dataLabels = list(enabled = FALSE)) %>%
  hc_add_series(name = "% Voted Republican", data = yr$Per_Republican, dataLabels = list(enabled = FALSE)) %>%
  hc_colors(c("#1E90FF", "Red" ))%>%
  hc_title(text = "34 to 67 percentile") %>%
  hc_tooltip(
    crosshairs = list(enabled=TRUE, color="#CDC673"), backgroundColor = "#f0f0f0",
    shared = TRUE, borderWidth = 1) %>%
  hc_yAxis(labels = list(format = "{value}%"),min= 10,  max= 90)  %>%
  hc_exporting(enabled = FALSE) %>%
  hc_add_theme(thm)

yr<-filter (yr1, Income=="68 to 95 percentile")
col1<-  highchart() %>%
  hc_chart(type = "line")%>%
  hc_xAxis(categories = yr$year) %>%
  hc_add_series(name = "% Voted Democrat", data = yr$Per_Democrat, dataLabels = list(enabled = FALSE)) %>%
  hc_add_series(name = "% Voted Republican", data = yr$Per_Republican, dataLabels = list(enabled = FALSE)) %>%
  hc_colors(c("#1E90FF", "Red" ))%>%
  hc_title(text = "68 to 95 percentile") %>%
  hc_tooltip(
    crosshairs = list(enabled=TRUE, color="#CDC673"), backgroundColor = "#f0f0f0",
    shared = TRUE, borderWidth = 1) %>%
  hc_yAxis(labels = list(format = "{value}%"),min= 10,max= 90)  %>%
  hc_exporting(enabled = FALSE) %>%
  hc_add_theme(thm)

yr<-filter (yr1, Income=="96 to 100 percentile")
top<-  highchart() %>%
  hc_chart(type = "line")%>%
  hc_xAxis(categories = yr$year) %>%
  hc_add_series(name = "% Voted Democrat", data = yr$Per_Democrat, dataLabels = list(enabled = FALSE)) %>%
  hc_add_series(name = "% Voted Republican", data = yr$Per_Republican, dataLabels = list(enabled = FALSE)) %>%
  hc_colors(c("#1E90FF", "Red" ))%>%
  hc_title(text = "96 to 100 percentile") %>%
  hc_tooltip(
    crosshairs = list(enabled=TRUE, color="#CDC673"), backgroundColor = "#f0f0f0",
    shared = TRUE, borderWidth = 1) %>%
  hc_yAxis(labels = list(format = "{value}%"),min= 10, max= 90)  %>%
  hc_exporting(enabled = FALSE) %>%
  hc_add_theme(thm)

hw_grid(low, mid, high, col1, top, rowheight = 400, ncol = 5)  %>% browsable()



Education

yr1<-  group_by(a1,  year, Education)%>%
  summarise(No.of.Obs = n(),Per_Republican= round(weighted.mean(VoteR, Weight, na.rm = TRUE)*100))%>%
          mutate(  Per_Democrat = 100-Per_Republican)
yr1<-na.omit(yr1)

thm<- hc_theme_tufte2()

yr<-filter (yr1, Education=="0-8 grades")

low<-highchart() %>%
  hc_chart(type = "line")%>%
  hc_xAxis(categories = yr$year) %>%
  hc_add_series(name = "% Voted Democrat", data = yr$Per_Democrat, dataLabels = list(enabled = FALSE)) %>%
  hc_add_series(name = "% Voted Republican", data = yr$Per_Republican, dataLabels = list(enabled = FALSE)) %>%
  hc_colors(c("#1E90FF", "Red" ))%>%
  hc_title(text = "0-8 grades") %>%
  hc_tooltip(
    crosshairs = list(enabled=TRUE, color="#CDC673"), backgroundColor = "#f0f0f0",
    shared = TRUE, borderWidth = 1) %>%
  hc_yAxis(labels = list(format = "{value}%"), min= 0,
           max= 100)  %>%
  hc_exporting(enabled = FALSE) %>%
  hc_add_theme(thm)


yr<-filter (yr1, Education=="High school")
mid<-highchart() %>%
  hc_chart(type = "line")%>%
  hc_xAxis(categories = yr$year) %>%
  hc_add_series(name = "% Voted Democrat", data = yr$Per_Democrat, dataLabels = list(enabled = FALSE)) %>%
  hc_add_series(name = "% Voted Republican", data = yr$Per_Republican, dataLabels = list(enabled = FALSE)) %>%
  hc_colors(c("#1E90FF", "Red" ))%>%
  hc_title(text = "High School") %>%
  hc_tooltip(
    crosshairs = list(enabled=TRUE, color="#CDC673"), backgroundColor = "#f0f0f0",
    shared = TRUE, borderWidth = 1) %>%
  hc_yAxis(labels = list(format = "{value}%"),min= 0,
           max= 100)  %>%
  hc_exporting(enabled = FALSE) %>%
  hc_add_theme(thm)



yr<-filter (yr1, Education=="Some college")
high<-  highchart() %>%
  hc_chart(type = "line")%>%
  hc_xAxis(categories = yr$year) %>%
  hc_add_series(name = "% Voted Democrat", data = yr$Per_Democrat, dataLabels = list(enabled = FALSE)) %>%
  hc_add_series(name = "% Voted Republican", data = yr$Per_Republican, dataLabels = list(enabled = FALSE)) %>%
  hc_colors(c("#1E90FF", "Red" ))%>%
  hc_title(text = "Some college") %>%
  hc_tooltip(
    crosshairs = list(enabled=TRUE, color="#CDC673"), backgroundColor = "#f0f0f0",
    shared = TRUE, borderWidth = 1) %>%
  hc_yAxis(labels = list(format = "{value}%"),min= 0,
           max= 100)  %>%
  hc_exporting(enabled = FALSE) %>%
  hc_add_theme(thm)

yr<-filter (yr1, Education=="College+")
col1<-  highchart() %>%
  hc_chart(type = "line")%>%
  hc_xAxis(categories = yr$year) %>%
  hc_add_series(name = "% Voted Democrat", data = yr$Per_Democrat, dataLabels = list(enabled = FALSE)) %>%
  hc_add_series(name = "% Voted Republican", data = yr$Per_Republican, dataLabels = list(enabled = FALSE)) %>%
  hc_colors(c("#1E90FF", "Red" ))%>%
  hc_title(text = "College+") %>%
  hc_tooltip(
    crosshairs = list(enabled=TRUE, color="#CDC673"), backgroundColor = "#f0f0f0",
    shared = TRUE, borderWidth = 1) %>%
  hc_yAxis(labels = list(format = "{value}%"),min= 0,
           max= 100)  %>%
  hc_exporting(enabled = FALSE) %>%
  hc_add_theme(thm)


hw_grid(low, mid, high, col1, rowheight = 400, ncol = 4)  %>% browsable()



Vote Republican

All analysis below uses % Republican Vote as Outcome


Each line represents election cycle. Graph on the right shows difference in voting for the lowest and highest income groups for each election year (hover to see numbers).

inc<-   group_by( a1, year, Income)%>%
  summarise(No.of.Obs = n(),Per_Republican= round(weighted.mean(VoteR, Weight, na.rm = TRUE)*100))%>%
  mutate(  Per_Democrat = 100-Per_Republican)
inc<-na.omit(inc)
hc_incy<-hchart(inc, type="spline", x=Income, y=Per_Republican, group=year)%>%
  hc_title(text = "Republican Vote Share: by Income & Years (1948-2012") %>%
  hc_subtitle(text = "Source: American National Election Studies (ANES)")%>%
  hc_tooltip(crosshairs = list(enabled=TRUE, color="#CDC673"), backgroundColor = "#f0f0f0",
             shared = TRUE, borderWidth = 1) %>%
  hc_yAxis(title = list(text = "% who Voted Republican"),labels = list(format = "{value}%"))  %>%
  hc_add_theme(hc_theme_tufte2())

inc_d<- filter (inc, Income=="0 to 16 percentile")%>%
  mutate (low=Per_Republican)%>%
  select(year, low)
inc_d<- inner_join(inc, inc_d, by="year")%>%
  mutate(diff=Per_Republican-low)


low<- filter(inc_d, Income=="0 to 16 percentile" | Income=="96 to 100 percentile" )

hc_inc_d<-hchart(low, type="spline", x=Income, y=diff, group=year)%>%
  hc_title(text = "Gap b/w Low & High Income") %>%
  hc_colors("pink")%>%
  hc_tooltip(
    crosshairs = list(enabled=TRUE, color="#CDC673"), backgroundColor = "#f0f0f0",
    shared = TRUE, borderWidth = 1) %>%
  hc_yAxis(title = list(text = "Difference in Republican Share"),labels = list(format = "{value}%"))  %>%
  hc_add_theme(hc_theme_tufte2())

# Use shiny
fluidPage(
  fluidRow(
    column(8, hc_incy), column(4, hc_inc_d) 
  )
)%>% browsable()



inc <- group_by(a1,  year, Income, Census_Region)%>%
  filter (year!="1948")%>%
  summarise(Per_Republican = round(weighted.mean(VoteR, Weight, na.rm = TRUE)*100))
inc<-na.omit(inc)           

inc_d <- filter (inc, Income=="0 to 16 percentile")%>%
  mutate (low=Per_Republican)
inc_d$Income<-NULL
inc_d1<- merge(inc, inc_d, by=c("year", "Census_Region"))
inc_d<- mutate(inc_d1, diff=Per_Republican.x-low)%>%
    filter (Income=="0 to 16 percentile"| Income=="96 to 100 percentile")

# Define Color for each region
colors <- as.character(c("#EECA00", "#EE1200", "#D89232", "#B71C1C"))
region <- c("East", "West", "MidWest", "South")
inc_d$region_color <- colors[match(inc_d$Census_Region, region)]

fig1 <- (lapply(split(inc_d, inc_d$Census_Region), function(inc_d) {
  hchart(inc_d, type="spline", x=Income, y=diff, group=year)%>%
    hc_colors(inc_d$region_color) %>%
    hc_title(text = unique(inc_d$Census_Region)) %>%
    hc_tooltip(
      crosshairs = list(enabled=TRUE, color="#CDC673"), backgroundColor = "#f0f0f0",
      shared = TRUE, borderWidth = 1) %>%
    hc_yAxis(title = list(text = "Difference"),labels = list(format = "{value}%"), max=80) %>%
    hc_add_theme(hc_theme_tufte2())
}))
hw_grid(fig1, rowheight = 400, ncol = 4)  %>% browsable()



inc1<-filter(a1, Race=="White")
inc<-   group_by(inc1,  year, Income33)%>%
  filter (year!="1948")%>%
  summarise(No.of.Obs = n(),Per_Republican = round(weighted.mean(VoteR, Weight, na.rm = TRUE)*100))
inc<-na.omit(inc)           


hchart(inc, type="line", x=year, y=Per_Republican, group=Income33)%>%
  hc_title(text = "Republican Vote Share by Income: WHITE VOTERS ONLY") %>%
  hc_subtitle(text = "Note: Income Percentile recoded to 33%") %>%
  hc_tooltip(crosshairs = list(enabled=TRUE, color="#CDC673"), backgroundColor = "#f0f0f0",
             shared = TRUE, borderWidth = 1) %>%
  hc_yAxis(title = list(text = "% who Voted Republican"),labels = list(format = "{value}%"))  %>%
   hc_legend(enabled=TRUE, layout = "horizontal", verticalAlign = "bottom",
            floating = FALSE, align = "center")  %>%
  hc_colors(c("#8A2BE2", "#858585",  "#66CD00"))%>%
  hc_add_theme(hc_theme_tufte2())



Red & Blue State


The graphs below show the main nteractions between income and voting. Here we plot the DIFFERENCE in Republican vote share of High Income (top 33%) and low income (bottom 33%)–BY Red and Blue states (based on 2012 outcomes).

Note that the Income gap for Republican vote is consistently higher in Red states. Intuition (and in-depth analysis) of this is provided by Gelman et al. (2007).

inc2 <- group_by(a1,  year, Income33, Red_Blue) %>% filter (year!="1948") %>%
  summarise(Per_Republican = round(weighted.mean(VoteR, Weight, na.rm = TRUE)*100))

inc2<-na.omit(inc2)           

inc_d2 <- filter (inc2, Income33=="Low33")%>%
  mutate (low=Per_Republican)
inc_d2$Income33<-NULL
inc_d2<- merge(inc2, inc_d2, by=c("year", "Red_Blue"))
inc_d2<- mutate(inc_d2, diff=Per_Republican.x-low)%>%
  filter (Income33=="Low33" | Income33=="High33")


h1 <- inc_d2 %>% filter(Income33 == "High33")

a <-highchart() %>%
    hc_xAxis(categories = h1$year) %>%
    hc_add_series_df(h1, type="spline", x=year, y=diff, group = Red_Blue)%>%
    hc_colors(c("blue", "red")) %>%
    hc_title(text = "Republican Vote Share: Gap b/w Low & High Income in Red & Blue State") %>%
    hc_subtitle(text = "Source: American National Election Studies (ANES)")%>%
    hc_tooltip(crosshairs = list(enabled=TRUE, color="#CDC673"), backgroundColor = "#f0f0f0",
               shared = TRUE, borderWidth = 1) %>%
    hc_yAxis(title = list(text = "Difference in Republican Share"),labels = list(format = "{value}%"), max=50)  %>%
    hc_add_theme(hc_theme_tufte2())

inc2 <- group_by(a1,  year, Income33, Red_Blue) %>% filter (year!="1948") %>%
  summarise(Per_Republican = round(weighted.mean(VoteR, Weight, na.rm = TRUE)*100))

inc2<-na.omit(inc2)           

inc_d2 <- filter (inc2, Income33=="Low33")%>%
  mutate (low=Per_Republican)

inc_d2$Income33<-NULL

inc_d1<- merge(inc2, inc_d2, by=c("year", "Red_Blue"))

inc_d<- mutate(inc_d1, diff=Per_Republican.x-low)%>%
  filter (Income33=="Low33"| Income33=="High33")

# Define Color for each region

colors <- as.character(c("#1874CD", "#FF3030"))
region <- c("Blue", "Red")
inc_d$region_color <- colors[match(inc_d$Red_Blue, region)]

fig1 <- (lapply(split(inc_d, inc_d$Red_Blue), function(inc_d) {

    hchart(inc_d, type="spline", x=Income33, y=diff, group=year)%>%
    hc_colors(inc_d$region_color) %>%
    hc_title(text = unique(inc_d$Red_Blue)) %>%
    hc_tooltip(
      crosshairs = list(enabled=TRUE, color="#CDC673"), backgroundColor = "#f0f0f0",
      shared = TRUE, borderWidth = 1) %>%
    hc_yAxis(title = list(text = "Difference"),labels = list(format = "{value}%"), max=50) %>%
    hc_add_theme(hc_theme_tufte2())
}))

b <- hw_grid(fig1, rowheight = 400, ncol = 2)  %>% browsable()

fluidPage(
  fluidRow(a),
  fluidRow(b))



3. County Analysis

Log Income


c1 <- readRDS("./Data/county.rds")

c1$loginc <- log(c1$Median_income)
dem2= dplyr :: select(c1, Per_Obama, loginc, Population, geo_4, county_name)
dem2$geo_4 <- factor(dem2$geo_4, levels = c("Blue", "Swing", "Red"))

  m <- loess(Per_Obama ~ loginc, data = dem2)
  m <- broom::augment(m) 

a <-  plot_ly(data = dem2,  x = ~loginc, y = ~Per_Obama, width = 800, height = 400) %>%
    add_markers(size = ~Population, sizes = c(1, 1000),
                showlegend = FALSE, color = ~geo_4, colors = c("#1874CD", "Red", "grey"),
                text = ~paste('County Name: ', county_name), hoverinfo = "text") %>%
    add_ribbons(data= m, ymin = ~.fitted -  .se.fit, 
                ymax = ~.fitted +  .se.fit, color = I("gray80"), showlegend = FALSE) %>%
    add_lines(data= m, y = ~.fitted, color = I("steelblue"), showlegend = FALSE) %>%
    layout(title = "Correlation of Income & % Obama", yaxis = list(title = "% Vote for Obama"),xaxis = list(title = "Log Income") )
 
fig1 <- (lapply(split(dem2, dem2$geo_4), function(dem2) {
  m <- loess(Per_Obama ~ loginc, data = dem2)
  m <- broom::augment(m) 

  plot_ly(data = dem2,  x = ~loginc, y = ~Per_Obama, width = 800, height = 400) %>%
    add_markers(size = ~Population, sizes = c(1, 1000),
                showlegend = FALSE, color = ~factor(geo_4), colors = c(`Red` = "red", `Swing` = "grey", `Blue` = "#1874CD"), text = ~paste('County Name: ', county_name), hoverinfo = "text") %>%
    add_ribbons(data= m, ymin = ~.fitted -  .se.fit, 
                ymax = ~.fitted +  .se.fit, color = I("gray80"), showlegend = FALSE) %>%
    add_lines(data= m, y = ~.fitted, color = I("steelblue"), showlegend = FALSE) %>%
    layout(xaxis = list(title = unique(dem2$geo_4)), yaxis = list(title = "% Vote for Obama"))
}))

b <- subplot(fig1, titleX = TRUE, titleY = TRUE, shareY = TRUE) 

fluidPage(
  fluidRow(a),
  fluidRow(b)) %>% browsable()