You could probably make them numeric, like

> v<-c("a","a","b","c")
> f<-factor(v)
> as.numeric(f)
[1] 1 1 2 3

to get a numeric "rock_id", but i wouldn't per se recommend it.  

You should ask someone who knows more about the scientific side of this method 
to tell you how factorial data is properly treated.


On 12.07.2012, at 03:35, Jeremy Little wrote:

> 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.
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to