I have a data frame composed of 10 variables. One variable is the station ID. I have 10 stations (A, B, C, ,and J) with daily observation for five years for each station. I have 18260 observations in total. My observations contain NA for many days. My dataframe looks like this
stationID x1 x2 x3 x4 x10
A
A
A
A
B
B
B
B
C
C
C
C
J
J
J
I want to get the summary statistics (mainly n, mean, median and sd) for each variable based on the station name.
I though about
library(psych)
describeBy(mydf, mydf$stationID)
I got the summary statistics for all variables as table for each station. But I want to get something like this
station A station B station C station J
var.2 n
mean
sd
median
Var.3 n
mean
sd
median
Var.10 n
mean
sd
median
I didn't get the summary statistics when the variable has NA. How can I get the output of summary statistics as shown for all variables including those who have NA?
I believe this question is different than other suggested questions/answers because it has more than one statistical parameter and my observations contain NA