Hi @bernahgrl, welcome to RStudio Community.
It would be much easier for people to help you if you post a reproducible example (or reprex). Please read this post to learn how to create a minimal reprex.
In the absence of a reprex, I can only provide general advice. summarise()
only keeps the grouping variables and summary measures. If you want to retain all variables, consider using mutate()
instead to add those measures into a new variable and then work with that.
aggregate()
isn't a dplyr
function. If you want to perform your analysis per company, you might want to add company as a grouping variable.