从 psych::alpha 输出中提取特定列时出现问题

Issue in extracting a specific column from psych::alpha output

library(mirt) #this contains a dataset called deAyala.
library(psych) #this contains the alpha() function.
alpha(deAyala) 

使用这个函数得到以下数据集:

Some items ( Item.4 Item.5 ) were negatively correlated with the total scale and 
probably should be reversed.  
To do this, run the function again with the 'check.keys=TRUE' option
Reliability analysis   
Call: alpha(x = deAyala)

  raw_alpha std.alpha G6(smc) average_r  S/N     ase mean  sd
   0.00097      0.21    0.32     0.042 0.27 0.00057  103 134
 median_r
        0

 lower alpha upper     95% confidence boundaries
0 0 0 

 Reliability if an item is dropped:
          raw_alpha std.alpha G6(smc) average_r   S/N
Item.1      5.9e-05     0.019   0.057    0.0038 0.019
Item.2      6.5e-04     0.178   0.293    0.0414 0.216
Item.3      8.4e-04     0.220   0.342    0.0535 0.283
Item.4      1.2e-03     0.289   0.385    0.0750 0.406
Item.5      1.3e-03     0.306   0.387    0.0812 0.442
Frequency   0.0e+00     0.000   0.000    0.0000 0.000
          alpha se var.r med.r
Item.1     0.00056 0.011     0
Item.2     0.00055 0.044     0
Item.3     0.00054 0.047     0
Item.4     0.00052 0.044     0
Item.5     0.00051 0.041     0
Frequency  0.27951 0.000     0

 Item statistics 
           n raw.r std.r  r.cor r.drop  mean     sd
Item.1    32  0.60  0.59  0.657   0.60   0.5   0.51
Item.2    32  0.22  0.45  0.202   0.22   0.5   0.51
Item.3    32  0.10  0.41  0.080   0.10   0.5   0.51
Item.4    32 -0.11  0.33 -0.059  -0.11   0.5   0.51
Item.5    32 -0.17  0.31 -0.079  -0.17   0.5   0.51
Frequency 32  1.00  0.61  0.722   0.29 612.5 804.25

Non missing response frequency for each item
         0   1 miss
Item.1 0.5 0.5    0
Item.2 0.5 0.5    0
Item.3 0.5 0.5    0
Item.4 0.5 0.5    0
Item.5 0.5 0.5    0

我只想要项目统计信息 table 中的 raw.r 列 ([1:6] 0.6 0.223 0.103 -0.112 -0.174),并且我想将它们存储在一个变量中。我怎样才能做到这一点?我尝试了以下方法:

str(alpha(deAyala)$item.stats$raw.r)

但这给了我很多文字:

Some items ( Item.4 Item.5 ) were negatively correlated with the total scale and 
probably should be reversed.  
To do this, run the function again with the 'check.keys=TRUE' option num [1:6] 0.6 0.223 0.103 -0.112 -0.174 ...
Warning message:
In alpha(deAyala) :
  Some items were negatively correlated with the total scale and probably 
should be reversed.  
To do this, run the function again with the 'check.keys=TRUE' option

您可以通过用 suppressWarnings() 包装警告位来摆脱警告位,但消息的第一位看起来只是 alpha() 函数中的打印语句。不过这会起作用

invisible(capture.output(x <- suppressWarnings(alpha(deAyala)$item.stats$raw.r)))

编辑:实际上我只是查看了 alpha 的帮助,它有一个 warnings 选项,您可以将其设置为 FALSE