filtering and save

Hi all,

I am trying to make a plot - one for death rates (which was succesfully done) but now I just want to look at deaths but I am not sure how to get it done as nothing is working.

For death rates, I was able to isolate those variables but cannot figure it our for just deaths.:
This is the one for death rates:ind1 <- nchs$cause=="Unintentional injuries" & nchs$state=="United States"
Unintentional.injuries <- aggregate(nchs$rate[ind1],list(nchs$year[ind1]),mean)
Unintentional.injuries
worked fine and the one below does not work - any suggestions, I am not sure how to rename variables (very new to Rstudio) hope this makes sense

indiv1=nchs$deaths=="Unintentional injuries1" & nchs$state=="United States"
Unintentional.injuries1 <- aggregate(nchs$deaths[indiv1],list(nchs$year[indiv1]),mean)
Unintentional.injuries1


Description of issue -

System Information:

  • RStudio Edition: (Desktop or Server)
  • RStudio Version:
  • OS Version:
  • R Version:
  • sessionInfo():

Referred here from support.rstudio.com

Can you provide a reproducible example?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.