I am trying to get the sum of 7 of my 14 columns in a data frame and when I do this:
Sum_div1FBS_revenuedata <- Updated_div1FBS_revenuedata%>%
replace(is.na(.), 0) %>%
mutate(Total_Revenue = sum(c(baseball,mens_basketball,womens_basketball,men_TFXC,womens_TFXC,softball,football)))
But I got the total revenue as the same number for each row. When I did it this way:
Sum_div1FBS_revenuedata <- Updated_div1FBS_revenuedata%>%
replace(is.na(.), 0) %>%
mutate(Total_Revenue = rowSums(Updated_div1FBS_revenuedata[2:8],))
Total Revenue was NaN for all the rows.
How do I fix that or is there a better way to sum columns?