I'm very new to R. I want to rename the column (total=n()) or create a new one from that one. Can I do it simply in R or should I export the dataframe into Excel, and build the column in Excel.
State Year Weapon_label (total = n())
Alaska 1976 Other weapons 1
Alabama 1976 Other weapons 16
Arkansas 1976 Other weapons 5
Arizona 1976 Other weapons 6
To get (total=n()) I code:
murderso <- murderso %>%
select(State, Year, Weapon_label) %>%
group_by(State, Year, Weapon_label) %>%
summarise(total=n())
Any suggestion for a beginner? Thanks for help