I am trying to merge all the rows that have the same name within the column "Tree" and have all values in the other columns summarized. I have tried with:
(and some other solutions I found, but they didn't fit my case.)
but either got a dataframe that included JUST the Tree column or a very weird dataframe where everything was merged appropriately but values were shown as binary (how did that even happen???)
I'm sorry if the solution is actually an easy one, but I haven't found a solution where it wasnt based on multiple columns and I want to refrain from listing 335 columns in my code.
If you're seeing weird results, check the types of your columns with sapply(df, class). I can't tell from your snapshot. It's possible some of those columns that you think are numeric are actually factor or character, in which case the mean will fail.
Curious -how are the values messed up? Impossible for me to see the whole set of results from the snapshot, but at least for these rows it looked like the values were all zero, and then upon taking the means, the means are sensibly zero too.
I want the values of the rows added together. This is species abundance data on different trees. So one tree was counted on seperate months, which is why there are multiple cases of the same trees. I want the amount of individuals captured per months added up, so that I have the total of the number of individuals captured.
Then I get this error: problem with summarise() input Acrotona.aterrima.
x invalid'type' (character) of the argument
i Input Acrotona.aterrima is .Primitive("sum")(Acrotona.aterrima, .groups = "drop").
i The error occurred in group 1: Tree = "mof_cst_00001".