I have two data frames with a number of common variables that I wish to put into
"long format".
The first contains the variables
es(Csales)
[1] "terr" "Dec.02" "Jan.03" "Feb.03"
"Mar.03" "Apr.03" "May.03" "Jun.03"
[9] "Jul.03" "Aug.03" "Sep.03" "Oct.03"
"Nov.03" "Dec.03" "Jan.04" "Feb.04"
[17] "Mar.04" "Apr.04" "May.04" "Jun.04"
"Jul.04" "Aug.04" "Sep.04" "Oct.04"
For this the following code works fine.
Csall<-reshape(Csales, idvar = "terr", timevar =
"month",
varying =
list(c("Dec.02","Jan.03","Feb.03","Mar.03",
"Apr.03","May.03","Jun.03","Jul.03","Aug.03","Sep.03",
"Oct.03","Nov.03","Dec.03","Jan.04","Feb.04","Mar.04",
"Apr.04","May.04","Jun.04","Jul.04","Aug.04","Sep.04",
"Oct.04")),direction = "long")
The second dataset contains the variables
es(Ccalls)
[1] "TERRITORY" "REGION"
"ACTIVITY_TYPE"
[4] "CONTACT_TYPE" "TARGETED_FLG"
"CONTACT_GRADE"
[7] "CONTACT_PR_SPECIALITY" "UBM"
"DEC02"
[10] "JAN03" "FEB03"
"MAR03"
[13] "APR03" "MAY03"
"JUN03"
[16] "JUL03" "AUG03"
"SEP03"
[19] "OCT03" "NOV03"
"DEC03"
[22] "JAN04" "FEB04"
"MAR04"
[25] "APR04" "MAY04"
"JUN04"
[28] "JUL04" "AUG04"
"SEP04"
[31] "OCT04"
Trying the following code on this set produces an error
Ccall<-reshape(Ccalls, idvar = "TERRITORY, timevar =
"MONTH",
v.names =
list(c("TERRITORY","REGION","ACTIVITY_TYPE","CONTACT_TYPE",
"TARGETED_FLG","CONTACT_GRADE","CONTACT_PR_SPECIALITY","UBM")),
varying =
list(c("Dec.02","Jan.03","Feb.03","Mar.03",
"Apr.03","May.03","Jun.03","Jul.03","Aug.03","Sep.03",
"Oct.03","Nov.03","Dec.03","Jan.04","Feb.04","Mar.04",
"Apr.04","May.04","Jun.04","Jul.04","Aug.04","Sep.04",
"Oct.04")),direction = "long")
Where am I going wrong here?
Any help would be greatly appreciated.
Kind regards
Dr Graham Leask
Economics and Strategy Group
Aston Business School
Aston University
Aston Triangle
Birmingham
B4 7ET
Tel: Direct line 0121 204 3150
email g.leask@aston.ac.uk
[[alternative HTML version deleted]]