Im working on heatmaps for New Jersey population, the dataset is called "NJ" and it has a column called "Population". I want to define the color buckets for the range of population. However, when I use the code given below, it always gives me an error of : Error in NJ$Population : $ operator is invalid for atomic vectors
NJpalette<-brewer.pal(7,"Blues")
NJ$colorBuckets<-as.numeric(cut(NJ$Population,c(0,150000,30000,450000,600000,750000,900000,1000000)))
I dont unerstand why it happens, I read that instead of using $ I could call population using
NJ[Population]
However, even that doesnt help. Can someone please suggest how to go forward