I have a data frame with variable importance for 4 variables across 10 samples (Fold01, Fold02, etc) for 3 classes (cols). I would like a data frame that calculates the aggregate mean and SD across folds for each variable, resulting in 4 rows. I would then like to plot the means and error bars for each class/species. I would be very grateful for help.
> dput(importance_df2)
structure(list(setosa = c(8.20355609194933, 5.15249911622198,
13.9558863013725, 15.2128507245513, 14.2287841553551, 1.51099471303875,
14.1741359032028, 12.5576190653829, 12.7135584510845, 1.63263917927766,
13.1206666145443, 12.184133136283, 12.794551602574, 3.32611050072169,
12.1568044940333, 13.662063280372, 8.03308199276954, -1.10566445521712,
15.6069320089807, 13.9645321784155, 6.80447069712796, 9.3523987791519,
12.1282981646457, 12.6980178576138, 5.05449196196674, 8.36182912000269,
13.776929730243, 13.2942285027714, 11.0813984016604, 4.9605895727141,
12.0039375765177, 12.3734970858531, 5.98547101050249, 9.36005244631558,
13.3434619850693, 13.3619015895155, 5.57715669965123, 5.91335297168266,
14.7795763793108, 13.9430150789271), versicolor = c(-1.7002694195893,
3.06911291029383, 11.5092164162373, 11.2528327233939, 7.69343208447305,
-1.17756934401283e-16, 10.9209890906177, 11.7609136729957, 6.70639738269152,
0.760725774312731, 9.48740581370106, 12.2175825329555, 6.6958363476924,
-0.568258374571754, 11.3820406468415, 8.36469021380585, -2.56633828664633,
0.30863609523786, 12.70735779349, 10.1690080282048, -2.34618159209803,
5.85759172926667, 7.26861212538479, 8.13139740949972, 1.11527282794308,
5.41805836349278, 9.75695989109409, 12.1801573691389, 1.57083966687311,
-0.72799238491593, 5.25415187946201, 8.43460590077721, -1.41609558278021,
5.27752925941252, 14.1691762122916, 10.3601897701751, -0.37010471286716,
5.86816454137302, 10.4962595111475, 10.4105932209458), virginica = c(2.95093458552127,
-1.85802151725244, 14.4334119763945, 15.6277402157776, 8.17755144643701,
0.690058853263635, 15.854316157953, 14.7114006700544, 5.85078053147856,
-1.6706499415125, 14.0279702227116, 15.7554751132441, 9.40484079015884,
-1.2401814464269, 15.1239238118373, 9.07920704347448, 6.50694006432927,
-0.230186330684734, 16.0277589532947, 15.7679761862469, 2.47594955398933,
0.17408293127597, 13.5353271980825, 11.5562954214589, 5.40365512424528,
-1.73727046020804, 13.0804445714249, 13.8353978705698, 7.20354680090468,
-1.35268412835237, 10.9238912568498, 10.727891285877, 3.82785295202544,
0.221508441183689, 18.0183887569268, 10.1872583455874, 2.12449925682884,
-0.794798604577416, 13.2737225375695, 14.7611944191273)), row.names = c("Fold01.Sepal.Length",
"Fold01.Sepal.Width", "Fold01.Petal.Length", "Fold01.Petal.Width",
"Fold02.Sepal.Length", "Fold02.Sepal.Width", "Fold02.Petal.Length",
"Fold02.Petal.Width", "Fold03.Sepal.Length", "Fold03.Sepal.Width",
"Fold03.Petal.Length", "Fold03.Petal.Width", "Fold04.Sepal.Length",
"Fold04.Sepal.Width", "Fold04.Petal.Length", "Fold04.Petal.Width",
"Fold05.Sepal.Length", "Fold05.Sepal.Width", "Fold05.Petal.Length",
"Fold05.Petal.Width", "Fold06.Sepal.Length", "Fold06.Sepal.Width",
"Fold06.Petal.Length", "Fold06.Petal.Width", "Fold07.Sepal.Length",
"Fold07.Sepal.Width", "Fold07.Petal.Length", "Fold07.Petal.Width",
"Fold08.Sepal.Length", "Fold08.Sepal.Width", "Fold08.Petal.Length",
"Fold08.Petal.Width", "Fold09.Sepal.Length", "Fold09.Sepal.Width",
"Fold09.Petal.Length", "Fold09.Petal.Width", "Fold10.Sepal.Length",
"Fold10.Sepal.Width", "Fold10.Petal.Length", "Fold10.Petal.Width"
), class = "data.frame")