Skip to content
Prev 334289 / 398502 Next

To transform a vector of qualitatives values into a dataframe of quantitatives values

On 13-12-11 8:22 AM, PIKAL Petr wrote:
You mean "quotes", not parentheses.
A simpler way is to use model.matrix.  With your example,

X <- factor(X)
m <- model.matrix( ~ X - 1)

(The names of the columns may need adjusting.)

Duncan Murdoch