I have a larger data frame in R that I am looking to do some calculations with by row name. The data frame shown partially below, contains 236 weather stations with each station displayed nine times because each station has nine separate forecast hours for each weather variable. The fact that that each hour is not listed in its own column is irrelevant as I am looking to add the snowfall together and average the wind and temperature. Thus, my final data frame will concatenate the data frame into 236 rows (one for each station) with a total snowfall, average wind speed, and average temperature.
I have tried numerous functions within the apply family, and attempted this within the dplyr package, but it doesn't like row names. I'm also having trouble getting the data frame into an actual format (including R's proper data frame format) so that the row names and weather variables can have calculations done on them together. I listed the row names as a character, and cbind them to my original data frame as a matrix, but that doesn't work either.
Stuck here, any ideas?
Here is a small portion of my data frame (the copy paste functionality here won't let me keep it coherent looking so I added one station as best I could so the quotes aren't in the actual data) I do not have image rights yet. Thanks.
snowfall sfc.wind Tavg
EET - Alabaster, AL "0" "5.606221" "45.38081"
edit: I was told below how to properly paste in my matrix and here it is.
Sean's code below fixes my issue. It has the green check mark next to it.
snowfall sfc.wind Tavg
EET - Alabaster, AL 0.00000000 4.5129950 39.490030
EET - Alabaster, AL 0.00000000 4.5047869 36.087611
EET - Alabaster, AL 0.00000000 5.0126637 39.441394
EET - Alabaster, AL 0.00000000 5.0111759 45.682309
EET - Alabaster, AL 0.00000000 2.8716592 42.776499
EET - Alabaster, AL 0.00000000 2.7937856 37.322987
EET - Alabaster, AL 0.00000000 2.5351705 36.701948
EET - Alabaster, AL 0.00000000 1.9576756 34.456469
EET - Alabaster, AL 0.00000000 1.6846636 34.150641
BHM - Birmingham, AL 0.00000000 4.5466909 38.533949
BHM - Birmingham, AL 0.00000000 4.4607041 34.891818
BHM - Birmingham, AL 0.00000000 5.1888168 38.405422
BHM - Birmingham, AL 0.00000000 5.4596529 44.992042
BHM - Birmingham, AL 0.00000000 3.0826392 42.159321
BHM - Birmingham, AL 0.00000000 2.8546392 36.715275
BHM - Birmingham, AL 0.00000000 2.5729845 36.133261
BHM - Birmingham, AL 0.00000000 2.0355549 33.933232
BHM - Birmingham, AL 0.00000000 1.7289972 33.543341
DCU - Decatur, AL 0.00122047 3.6517845 34.109912
DCU - Decatur, AL 0.00000000 3.6832448 31.485904
DCU - Decatur, AL 0.00000000 4.2819648 35.502855
DCU - Decatur, AL 0.00000000 5.2777885 43.234060
DCU - Decatur, AL 0.00003937 3.0233904 40.613362
DCU - Decatur, AL 0.00003937 2.7680023 35.587844
DCU - Decatur, AL 0.00000000 2.0555607 34.899179
DCU - Decatur, AL 0.00000000 1.4499551 32.708740
DCU - Decatur, AL 0.00000000 1.2004947 32.616132