Using conditions in group_by()/summarize() loop
问题 I have a dataframe that looks something like this (I have a lot more years and variables): Name State2014 State2015 State2016 Tuition2014 Tuition2015 Tuition2016 StateGrants2014 Jared CA CA MA 22430 23060 40650 5000 Beth CA CA CA 36400 37050 37180 4200 Steven MA MA MA 18010 18250 18720 NA Lary MA CA MA 24080 30800 24600 6600 Tom MA OR OR 40450 15800 16040 NA Alfred OR OR OR 23570 23680 23750 3500 Cathy OR OR OR 32070 32070 33040 4700 My objective (in this example) is to get the mean tuition