I can't figure out why this is not working.
Have the following sample data:
MktAl Orig Dest
AA BWI DFW
AA BWI MIA
AA CLE DFW
AA CMH DFW
AA DAY DFW
AA DCA DFW
AA DCA JFK
AA DCA LAX
WN RDU TPA
WN BWI ATL
WN BWI DFW
WN BWI MIA
WN BWI MCO
I am trying to reshape the data to get something like this:
ORIG AA WN
BWI DFW ATL
BWI MIA DFW
BWI NA MIA
BWI NA MCO
CLE DFW NA
CMH DFW NA
DAY DFW NA
DCA DFW NA
DCA JFK NA
DCA LAX NA
RDU NA TPA
However, when I try to use the following command:
reshape(data=ks, direction="wide", timevar="MktAl", idvar="Orig")
I only get this:
Source: local data frame [6 x 2]
Orig Dest.1:2
(fctr) (fctr)
1 BWI NA
2 CLE NA
3 CMH NA
4 DAY NA
5 DCA NA
6 RDU NA
Any idea why this is not working?