Contact

Your Name:

Your Email Address:

Your Message:


2 Comments

  1. Hi Marco,

    Nice articles on pivots using melt and cast functions! Thanks for sharing :). I need your help in creating multiple pivots using melt and cast function. In the example of your blog, country wise filter is used. How to create different pivots for (eg, USA, UK). ? Need to use any for loops? Please guide me. Need your help.
    Waiting for reply!
    Thanks, Prajkta

    1. Hi Prajkta,
      you could be using apply() and variants, but this is a bit of an advanced way to do it. More linearly (but also less efficiently) you can use a for loop on the countries like for (s in unique(dat$Country)) and use the value of s as filtering condition (use subset=) to cast. This should do it.
      Cheers,
      Marco.

Leave a Reply

Your email address will not be published. Required fields are marked *