Consider the following dataframe in R:
df <- data.frame(Industry = c("Agriculture", "Fishery", "Industry"),
Value = c(10,20,30))
Consider I want to sum the value for "Agriculture" and "Fishery" (10 + 20 = 30). For example, I could do it like this:
df$Value[df$Industry == "Agriculture"] + df$Value[df$Industry == "Fishery"]
However, instead I want to create list with "Agriculture" and "Fishery", and thereafter summing the value. Because in my example I have a big data.frame, and that will make it a lot easier. How to do that?