I'm currently working with the psych package. I have the variables StockPrice, BookValuePS (PS = per share), EPS (= Earnings per share) and ESGscore.
I want to do some descriptive statistic for my final paper.
The code I use at the moment is:
install.packages("psych")
library(psych)
attach(data_excel)
describeBy(StockPrice, group = ggroup, mat = TRUE, skew = FALSE, quant=c(0.25, 0.75))
--> I first tried to to it with one X (=StockPrice) and this is the Output
item group1 vars n mean sd min max range se Q0.25 Q0.75
11 1 1010 1 133 64.75000 31.27857 12.59 184.07 171.48 2.712196 42.750 83.0000
12 2 1510 1 154 71.27513 39.00316 6.77 221.53 214.76 3.142964 40.675 94.8125
- Why is it using item 11 & 12?
Now I wanted to do the same thing, with more Xs and the same grouping.
describeBy(StockPrice, BookValuePS, EPS, ESGscore group = ggroup, mat = TRUE, skew = FALSE, quant=c(0.25, 0.75))
But there is the error notice:
unexpected symbol in "describeBy(StockPrice, BookValuePS, EPS, ESGscore group"
- Is there any way to get a complete output for all variables "grouped" by ggroup?
It would be so nice if you could help me out and if you need any data, let me know. :)
Happy New Year everybody and thanks for the help :)
11and12means: Notitem, theitemcolumn is1and2meaning that your grouping variableggrouphas 2 items or two levels.11and12are row names: if you wrap the whole thing aroundtibble()thy will disappear. In detail they mean first1= variable1, second1of11means level or item1of the grouping variable. You can get it if you follow the example at the end.You can analyze the complete dataset grouped with this formula input:
describeBy(data_excel ~ ggroup)To avoind the error:
Use this formula , here is an example with the
mtcarsdataset: