I have the output of a describeBy, which is working fine, but as my dataset has quite a lot of variables I'm not interested in at this point, it's very difficult to manage, is there a way to exclude variables (or perform describeBy on particular variables)?
Subset the data frame by a vector of column numbers (or negative column numbers to exclude), names or a logical vector. Here we only describe columns 2, 3 and 4.
library(psych)
data(sat.act) # test data
describeBy(sat.act[2:4], sat.act$gender)
giving:
Descriptive statistics by group
group: 1
vars n mean sd median trimmed mad min max range skew kurtosis se
education 1 247 3.00 1.54 3 3.12 1.48 0 5 5 -0.54 -0.60 0.10
age 2 247 25.86 9.74 22 24.23 5.93 14 58 44 1.43 1.43 0.62
ACT 3 247 28.79 5.06 30 29.23 4.45 3 36 33 -1.06 1.89 0.32
-----------------------------------------------------------------------------------------------------------------------------
group: 2
vars n mean sd median trimmed mad min max range skew kurtosis se
education 1 453 3.26 1.35 3 3.40 1.48 0 5 5 -0.74 0.27 0.06
age 2 453 25.45 9.37 22 23.70 5.93 13 65 52 1.77 3.03 0.44
ACT 3 453 28.42 4.69 29 28.63 4.45 15 36 21 -0.39 -0.42 0.22