Hi,

I have a dataset with 6 categorical variables. I have used this following code 
to make the variables u1-u6 ordered factors and this works well.


cat1cat2 cat3 cat4 cat5 cat6 
  0      1     1      0     0     1
  1      1     0      0     0     0
.......
....


############
data<-read,table("example.txt")

data <- as.data.frame(lapply(data, ordered)) 

############

Now, suppose I have bigger dataset where some variables are categorical (cat) 
and others are continuous (cont)..

cat1 cat2 cont1 cont2 ...cont10 cat3 cont11....cat 40 cont25  etc.


Is there a way to code so that R goes through each variable and orders a 
variable if it is categorical and leaves a variable alone if it is continuous?


Thanks,

 Debs


______________________________________________
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