search for: makefactor

Displaying 1 result from an estimated 1 matches for "makefactor".

2001 Jul 17
3
variable number of variables in data frames
I would like to specify that certain columns in a data frame should be treated as ordered factors. I know what numbers these columns are, but not their names. How do I do this? For example, if I know columns 1:4 are to be treated as factors, I can write dat <- matrix(c(2,1,1,1, 1,1,1,1), 2, 4) D <- as.data.frame(dat) # force all variables to be treated as binary # regardless of the small