I want to find the mean and standard deviation of the values present in a data frame,
> print(Data)
Description X24386
0 A 65.8751
1 A 152.6380
2 A 90.0535
3 A NA
4 B 74.4218
5 B 77.7234
6 B 79.7033
7 B 72.5045
8 C 79.3704
9 C 81.9795
Using the dcast aggregate I could group the data and find the mean
result<-dcast(D, Description ~ . ,fun.aggregate=mean)
> print(result)
Description .
1 B 76.08
2 C 80.67
3 A NA
Since a non-numeric value is present in one of the rows of group A, the mean is NA.
I'm looking for a syntax using which I can compute the mean of the columns that contain numeric values. I looked at the answers given in posts here
Since I want to find the mean for a specific column I am facing trouble in implementing it for my case.
Also, I would like to ask for suggestions on how
result<-dcast(D, Description ~ . ,fun.aggregate=mean)
can be modified to print the standard deviations in the column next to the mean.