我正在使用 psych 包,我尝试了以下代码:
library(psych)
str(price_per_d)
Least_appealing <-subset(zdf_base, select=c("price_per_h",
"price_per_d", "mileage", "one_way_option", "difficulties",
"vehicle_types", "parking_spot","picking_up","availability", "dirty",
"returning","refilling", "loalty_programs"))
# code from stackoverflow which I use, to get a numeric x
Least_appealing <- gsub(",", "", Least_appealing)
Least_appealing <- as.numeric(Least_appealing)
fa.parallel(Least_appealing)
我收到此错误消息:
> library(psych)
> str(price_per_d)
Factor w/ 1 level "Price (daily rate too high)": 1 NA 1 1 1 NA NA 1 1
NA ...
> Least_appealing <-subset(zdf_base, select=c("price_per_h",
+ "price_per_d",
"mileage", "one_way_option", "difficulties",
+ "vehicle_types",
"parking_spot","picking_up","availability", "dirty",
+ "returning","refilling",
"loalty_programs"))
>
> Least_appealing <- gsub(",", "", Least_appealing)
> Least_appealing <- as.numeric(Least_appealing)
**Warnmeldung:
NAs durch Umwandlung erzeugt**
>
> fa.parallel(Least_appealing)
**Fehler in cor(x, use = use) : supply both 'x' and 'y' or a matrix-like
'x'**
>
如何成功进行因子分析?首先我收到错误消息,我的“x”必须是数字,这就是我使用上述代码的原因。当我使用这段代码时,R 告诉我,我通过转换得到了 NA。我仍然继续尝试 fa.parallel,它给了我另一个错误消息。任何人都可以帮忙吗?