Problem with table funtion Lex Comber

Hi, I am a R beginner and trying to learn R with the Book R for Spatial Analysis and Mapping from Lex Comber and Chris Brundson. Self Test Question 2 tells me to do following steps :

#Self test question 2 
colours<-factor(c("red","blue","red","white","silver","red","white","silver","red","red","white",
                  "silver","silver"), levels=c("red","blue","white","silver","black"))
table(colours)
colours2<-c("red","blue","red","white","silver","red","white","silver","red","red","white","silver")
table(colours2)
car.type<-factor(c("saloon","saloon","hatchback","saloon","convertible","hatchback","convertible","saloon","hatchback","saloon","saloon",
                   "saloon","hatchback","saloon","saloon","saloon","hatchback"), 
                 levels=c("saloon","hatchback","convertible"))
table(car.type,colours)

PROBLEM The answer of the self test shows me a two way table of counts - that is , counts of red hatchbacks, silver saloons and so on. But what i get i an error note which says : ALL ARGUMENTS MUST HAVE THE SAME LENGTH ..

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.