[R] Package 'MASS' (polr): Error in svd(X) : infinite or missing values in 'x'

Jeremy Little jeremy.little at my.jcu.edu.au
Thu Jul 12 03:35:06 CEST 2012


Thanks Jessi,

your insights are extremely helpful.

If you would indulge me one more quick question on your script.
You have written...
newData<-data.frame(JVeg5=factor(Jdata[,"JVeg5"]),scale(Jdata[,c("Elevation","Lat_Y_pos","Coast_dist","Stream_dist")]))

I wish to expand this analysis for all other variables in my data matrix, of
which one is a factor (and therefore cannot be 'scaled').

Adding these variables to your script...
newData<-data.frame(JVeg5=factor(Jdata[,"JVeg5"]),scale(Jdata[,c("Elevation",
"Slope", "Aspect", "Hillshade", "Lat_Y_pos", "Coast_dist", "Coast_SE",
"Coast_E", "Wind_310", "Stream_dist", "TPI", "Landform", "Rock_Name")]))

...returns the error:
"Error in colMeans(x, na.rm = TRUE) : 'x' must be numeric"

because "Rock_Name" must be numeric to be scaled.

I've tried a couple of options for incorporating this factor (Rock_Name)
into the script without success.
For example:
 "newData<-data.frame(JVeg5=factor(Jdata[,"JVeg5"],
Rock_Name=factor(Jdata[,"Rock_Name"]), scale(Jdata[,c("Elevation", "Slope",
"Aspect", "Hillshade", "Lat_Y_pos", "Coast_dist", "Coast_SE", "Coast_E",
"Wind_310", "Stream_dist", "TPI", "Landform")]))"

Do you have a suggestion which might work for this analysis?

Thank you for your support with this, I really appreciate it.

kind regards





--
View this message in context: http://r.789695.n4.nabble.com/Package-MASS-polr-Error-in-svd-X-infinite-or-missing-values-in-x-tp4635829p4636244.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list