Reputation: 11
I have to first say that I am not an R user, but I want to apply a certain function I could only find in R.
My purpose is to get a bifactor factor-analysis model using the omega function from the Psych package. I have a data frame with 33 columns and about 100,000 observations and when I call the function (omega(df))
I get the following error:
Error in nchar(tv[1, 21]) : 'nchar()' requires a character vector
I have no idea what it means. If I follow the example in this doc with their data (named "bifact") it works fine, but the example uses a correlation matrix, while I want to use the entire data to be able to extract the factor scores. When I try to call the function with omega(cor(df))
I still get the same error.
Attached is a randomly generated data set that produces the same error. Any help would be highly appreciated.
A clue to the solution could be the fact that with set.seed(0) I get a different error than with set.seed(100):
set.seed(100)
s_df = as.data.frame(cbind(matrix(seq_len(10000), ncol=1), matrix(rnorm(n=6*10000, mean = 20, sd = 10), ncol=6)))[2:7]
omega(s_df)
Error in nchar(tv[1, 21]) : 'nchar()' requires a character vector
while:
set.seed(0)
s_df = as.data.frame(cbind(matrix(seq_len(10000), ncol=1), matrix(rnorm(n=6*10000, mean = 20, sd = 10), ncol=6)))[2:7]
omega(s_df)
Error in omega.diagram(omega, main = title, sl = sl, labels = labels, : object 'd.arrow' not found
EDIT: everything works when I call the function with plot=FALSE. However, I still would like the plot to work. (plot=TRUE) throughs the unwanted error.
Upvotes: 0
Views: 303
Reputation: 11
Ok, so it turns out I just didn't have the 'Rgraphviz' package installed.
After installing it everything worked great.
Upvotes: 0