Re: [R] Sum by group

2024-12-06 Thread Jeff Newmiller via R-help
That is what the "summarise" function is designed to do (instead of mutate). All of the calculations in a summarise have to aggregate all group rows down to one value, but that is what you want in this case. Please note that you are supposed to make your examples reproducible by including your

[R] Sum by group

2024-12-06 Thread D
I have population data (“totpopE”) at the census tract level (“GEOID”), which are nested within Precincts (“Precinct”). Please see below my data structure. I used the code to sum population data per precinct: inters <- inters %>% group_by(Precinct) %>% mutate(TotalPop = sum(totpopE) ) H

Re: [R] Creating a script in Rstudio

2024-12-06 Thread Robert Baer via R-help
This is off-topic for this list, but first use the file | import dataset menu.  Then go to the history tab, highlight the import statement that was generated and click to source.  You'll have to figure out where the reagent dataset is on your own. On 12/5/2024 9:21 AM, Carlos Alberto Baptista