I have a data frame of data I want to map. I've already created a base map called 'England'. The data frame is as follows:
'data.frame': 2303 obs. of 13 variables: $ Response.ID: int 1 2 3 4 5 6 7 8 9 10 ... $ Year : int 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 ... $ Sex : Factor w/ 2 levels "f","m": 1 2 1 1 1 1 2 2 2 2 ... $ Ethnicity : Factor w/ 6 levels "","Black","East Asian",..: 6 6 6 6 6 6 6 6 6 6 ... $ Age : int 24 22 16 22 49 21 62 36 21 75 ... $ Age.Group : Factor w/ 5 levels "> 80","16-20",..: 3 3 2 3 4 3 5 3 3 5 ... $ Town : Factor w/ 885 levels "Abbey Hey","Aberdare, Conwy",..: 781 259 421 259 229 92 836 276 594 276 ... $ Postcode : Factor w/ 987 levels "AB10","AB16",..: 888 888 886 888 884 685 270 301 78 300 ... $ Region : Factor w/ 11 levels "East Midlands",..: 9 9 9 9 9 9 9 9 9 9 ... $ Latitude : num 50.3 50.3 50.3 50.4 50.5 ... $ Longitude : num -3.66 -3.8 -3.61 -3.65 -3.52 ... $ Bread : Factor w/ 8 levels "Bap","Barm","Batch",..: 7 7 1 7 7 7 7 7 7 6 ... $ Icon : Factor w/ 8 levels "measle_brown",..: 2 2 1 2 2 2 2 2 2 8 ... The following command works on another similar data frame, but not on this one. >England+stat_bin2d(aes(x=Longitude,y=Latitude,color=factor(Bread$Bread),fill=factor(Bread$Bread)),size=.5,bins=200,alpha=.5,data=Bread) It returns the following error: Error in Bread$Sex : $ operator is invalid for atomic vectors What am I doing wrong here? I'm new to R, so I'm not sure if this is easy or difficult to solve. Thanks in advance! [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.