Error in x %*% w : requires numeric/complex matrix/vector arguments

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Error in x %*% w : requires numeric/complex matrix/vector arguments

Katya Fernandez
I’m trying to generate factor scores using the syntax below and when I try to generate them I get the following error: "Error in x %*% w : requires numeric/complex matrix/vector arguments.” My dataset is 12 variables, 81 observations, missing data is denoted by 999 (so no letters or blank spaces in the dataset). Does anyone know why I may be getting this error? Happy to provide additional information if that would be helpful.

## Read in data
dat=read.csv('pre002s.csv')

## Designate "999" as missing
dat[dat[,]==999] <- NA

## Load Psych package
library(psych)

## Read in CFA loadings
cfaload=read.table('loads.txt')

## Convert loadings to matrix
cfamat=as.matrix(cfaload[,2:4])

## Generate Factor Scores
fs=factor.scores(dat,cfamat,method='components')