title: Can we 'replace' a column from a pivot table created using 'pivottabler' package of r?
body: <p>I am using the 'pivottabler' package to create some pivot tables in R.</p>
  
  <p>Basically, the pivot tables I create have similar structure, only the column header changes.</p>
  
  <p>For example, I have a data set containing the prices of fruits based on region and month. 
  So I will create one pivot that will look like this:</p>
  
  <pre><code>Fruits   Nigeria   Laos   England
           Prices   Prices   Prices
  Apple      1$       2$       3$
  Mango      4$       5$       6$
  Orange     7$       8$       9$
  </code></pre>
  
  <p>And another pivot table that will look this:</p>
  
  <pre><code>Fruits    Jan      Feb     March
           Prices   Prices   Prices
  Apple      1$      1.5$      2$
  Mango      4$      4.5$      5$
  Orange     7$      7.5$      8$
  </code></pre>
  
  <p>Right now I am using two different codes to create both the pivots.</p>
  
  <pre><code>pt_country &lt;- PivotTable$new()
  pt_country$addData(Fruit_Prices) #Fruit_Prices is the data frame containing the data
  pt_country$addColumnDataGroups("Countries")
  pt_country$addRowDataGroups("Fruits")
  pt_country$defineCalculation(CalculationName = "Prices")
  pt_country$renderPivot()
  
  pt_country &lt;- PivotTable$new()
  pt_country$addData(Fruit_Prices) #Fruit_Prices is the data frame containing the data
  pt_country$addColumnDataGroups("Months")
  pt_country$addRowDataGroups("Fruits")
  pt_country$defineCalculation(CalculationName = "Prices")
  pt_country$renderPivot()
  
  </code></pre>
  
  <p>I want to shorten the code length, since there will be multiple such pivot tables.</p>
  
  <p>So, ideally I was looking for a solution that allows me to replace one column group with another without changes to other structures of code.</p>
  
  <p>Any help will be appreciated.</p>