Error in summarise_impl(.data, dots): Evaluation error: invalid 'type' (character) of argument

I think you need to convert Cluster from a factor to numeric before you do the gather step...

select(CUSTOMER_NUMBER, Cluster,PL_Order_Percentage,
         "PRIVATE LABEL.y","SUNDRY.y","Handpieces.y", Total_Sales, category) %>%
  ### At this point, Cluster is a factor while the other fields are numeric.
  ### The gather function doesn't know how to combine them and turns them into characters,
  ### which can't be summed later.
  ### Let's avoid that by making Cluster numeric...
  mutate(Cluster = as.numeric(Cluster)) %>%

  gather(bucket,value,-category) %>%
2 Likes