0

I have a data frame whose dim is [72, 592] i.e 72 observations with 592 variables. I would like to assign observations (rows) 1 to 37 as disease and rows 38 to 72 as control with the binary variables 0 and 1 (where 0 stands for disease and 1 stands for control) in the dataset. I also want to assign colours red and blue for the for the disease and control observations respectively.

My aim is that when I graphically represent the dataset, the variables that belong to the disease (or class 0) will show red and those for the control will show blue in colour. How can I achieve this?

Thomas
  • 43,637
  • 12
  • 109
  • 140
rinzy kutex
  • 1,195
  • 1
  • 12
  • 13
  • Welcome to StackOverflow. Your question lacks detail, please help us help you by providing us with a reproducible example (i.e. code and example data), see http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example for details.. In addition, reading a few R tutorials should go a long in solving these kinds of questions. – Paul Hiemstra May 13 '13 at 18:19

1 Answers1

0
cls = c(rep(0,37),rep(1,(72-37)))

clr = c(rep("red",37),rep("blue",(72-37)))

When you plot, you can use color=clr, etc.

harkmug
  • 2,725
  • 22
  • 26