Dear All,
   
  I  have a data as follows:
   
  ID <- 1:100
  Y <- rnorm(100)
  X <- rnorm(100)
  type <- as.factor(rep(1:3,100,time=1))
  df <- as.data.frame(cbind(ID, Y,X,type))
   
  I want to plot Y versus X  by specifying the pch to be as follows:
   
  Subjects having type = 1 must be plotted with a character pch =  "A"
  Subjects having type = 2 must be plotted with a pch =  "B"
  Subjects having type = 3 must be plotted with a pch =  21
   
  I used the follwomg:
   
  df$pch_type = recode(df$type, "1 = 'A'; 2 = 'B'; else = '21' " )
  plot(df$Y,df$X,pch= df$pch_type)
  This  plots subjects for type 1 and 2 with  symbols A and B (this is what expected) however subjects with type = 3 are plotted with a charcater 2 instead of a pch=21. I understand that this is due to the fact that the created vector "type_pch" cannot be a mixture between characters and numerics ... I tried to use a list for that purpsoe but fail...
   
  Any suggestions would be grateful,
   
  Many thanks,
   
  Bernard 
   
    
    

 		
---------------------------------

	[[alternative HTML version deleted]]

