0

I am trying to use the aggregate command in R with the data "crime." However I keep getting this error when I try to execute the command:

Error in FUN(X[[i]], ...) : object 'n' not found

My code is as follows:

crime<-read.csv("Crime_Reports.csv")



larcperneighborhood<-aggregate(crime, by=list(Larceny,Neighborhood), FUN = sum)
Error in FUN(X[[i]], ...) : object 'n' not found

vcoccurance<-aggregate(crime, by=list(DOJ.Violent.Crime,Neighborhood), FUN = sum)
Error in FUN(X[[i]], ...) : object 'n' not found

theftperneighborhood<-aggregate(crime, by=list(Theft,Neighborhood), FUN = sum)
Error in FUN(X[[i]], ...) : object 'n' not found

felperneighborhood<-aggregate(crime, by=list(Felony,Neighborhood), FUN = sum)
Error in FUN(X[[i]], ...) : object 'n' not found

I'm not sure what the next step is, I cannot find an 'n' in my data. Thank you!

Nicholas
  • 1
  • 1
  • 2
    Welcome to _Stack Overflow_! To help you we need something to reproduce your issue. i.e. *working* code and example data. There are several [*ways to provide data*](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610#5963610), probably adding the output of `dput(crime)` or `dput(head(crime))` to your question is sufficient. Consider [*How to make a great reproducible example*](https://stackoverflow.com/help/mcve) and edit your question, thanks. – jay.sf Mar 03 '19 at 12:41
  • Please also edit to only include code directly relevant to the question. – NelsonGon Mar 03 '19 at 12:52

0 Answers0