AmandaJane
AmandaJane

Reputation: 21

How to use princals in R - can't see what's wrong with my data

I am trying to run a nonlinear PCA using the princals function from the Gifi package. I want to know how my variables load on different components. I loaded the package and all my variables are ordinal variables, much like the example from the package documentation. I followed the package author's textbook **Modern Psychometrics with R - Patrick Mair **. I also followed the example from this tutorial: http://www.css.cornell.edu/faculty/dgr2/_static/files/R_html/NonlinearPCA.html but I get the same error when I run

GHQ_pca <- princals(GHQ_data_20)

The error is: Error in data.frame(..., check.names = FALSE) : arguments imply differing number of rows: 0, 350

I have checked my data frame multiple times and I can confirm that all columns have the same number of rows hence I can't understand why I keep getting this error. Has anyone run into this issue? All help is appreciated. Thanks!

Upvotes: 1

Views: 504

Answers (1)

AmandaJane
AmandaJane

Reputation: 21

Welp, seems I made a simple rookie mistake. My data frame structure was Classes ‘tbl_df’, ‘tbl’ and 'data.frame', and I simply needed to convert it to a proper data frame without all the other trimmings. Posting this here in case someone ever runs into this small issue.

Upvotes: 1

Related Questions