title: How to add Thousand separator in both axis of a 2-y axis chart in R using ggplot2
body: <p>With this code, only the left y-axis changes. I need that the right y-axis changes too.
  What can I do?</p>
  <pre><code>&gt; df_F10_H20_summary
  # A tibble: 3 x 5
    Dataset count_by_Data_FH    sum_Fsize mean_Fsize median_Fsize
    &lt;chr&gt;              &lt;int&gt;        &lt;dbl&gt;      &lt;dbl&gt;        &lt;dbl&gt;
  1 BOND                 660 346088878101 524377088.    211524144
  2 EQTY                1668 958120137292 574412552.    188492560
  3 MIXED                572 214626691552 375221489.    139865165
  
  scaleFactor &lt;- max(df_F10_H20_summary$count_by_Data_FH) / max(df_F10_H20_summary$sum_Fsize)
  #options(scipen=10000)
  ggplot(df_F10_H20_summary, aes(x=Dataset,  width=.4)) +
    geom_col(aes(y=count_by_Data_FH), fill=&quot;aquamarine3&quot;, position = position_nudge(x = -.4)) +
    geom_col(aes(y=sum_Fsize * scaleFactor), fill=&quot;aquamarine4&quot;) +
    scale_y_continuous(name=&quot;Number of Funds&quot;, 
                       sec.axis=sec_axis(~./scaleFactor, name=&quot;Total Value of Funds&quot;),
                       labels=function(y) format(y, big.mark = &quot;'&quot;, scientific = FALSE)) +
    scale_x_discrete(labels = c(&quot;BOND&quot;,
                                &quot;EQTY&quot;, &quot;MIXED&quot;)) +
    theme(
      axis.title.y.left=element_text(color=&quot;aquamarine3&quot;),
      axis.text.y.left=element_text(color=&quot;aquamarine3&quot;),
      axis.title.y.right=element_text(color=&quot;aquamarine4&quot;),
      axis.text.y.right=element_text(color=&quot;aquamarine4&quot;)
    ) +
    labs(title = &quot;Number of Funds and Total value by Asset &quot;, x = element_blank())
  
  </code></pre>
  <p><a href="https://i.stack.imgur.com/VZuJj.png" rel="nofollow noreferrer">enter image description here</a></p>