9.6 Lab: From wide to long and back

Let’s start with wide-format…

Table 9.3: Wide format
unit trust.2006 trust.2007 Victimization.2006 Victimization.2007
Peter 1 1 0 1
Paul 5 5 0 1
Pedro 6 6 1 0





Convert it to long-format…

Table 9.4: Long format
unit time trust Victimization
Peter 2006 1 0
Peter 2007 1 1
Paul 2006 5 0
Paul 2007 5 1
Pedro 2006 6 1
Pedro 2007 6 0





Convert it back to wide-format…

Table 9.5: Wide format
unit trust.2006 trust.2007 Victimization.2006 Victimization.2007
Paul 5 5 0 1
Pedro 6 6 1 0
Peter 1 1 0 1