R error in unique.default(x) unique() applies only to vectors

后端 未结 1 369
情深已故
情深已故 2020-12-09 16:19

I created a dataset named state from the built-in matrix state.x77 with two continuous variables (Population and Income) and two factor variables

相关标签:
1条回答
  • 2020-12-09 17:16

    This is a very common mistake, you need to use the named argument FUN:

    ave(state$inc, state$region, FUN = mean)
    

    otherwise mean will be interpreted as another grouping variable (part of the ... argument to ave.)

    0 讨论(0)
提交回复
热议问题