[R] converting numerical parts of factors into numeric vectors

Maria Wolters wolters at ikp.uni-bonn.de
Fri Apr 28 12:23:12 CEST 2000


Dear list,

Problem:
Given a factor that contains both numerical values and category codes, 
how can I extract the numerical values and store them in a numeric 
vector while preserving the exact values? as.numeric() replaces the 
numerical values by their factor levels. But since the values represent
an interval-scaled distance measure, this is not exactly what is called
for. 

Current workaround: replace category codes by arbitrary numbers to be filtered
out later. In this case, negative numbers.

More elegant solution: ?

I checked CRAN, V&R, and the online help, but to no avail.

Thanks in advance for your help. (The problem is not urgent,
see "Current Workaround" ;)

Maria Wolters
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list