  Dear R -users,
  Below is an example data, which contains three id-numbers. For each id there are three substances in each of the three blocks. Some substances are repeated twice.The subsatances are the same for all ids. The id number 3 is actually a control so all responses (y) that are equal or greater than 4 are supposed to be removed from this id number. This I can do easily in R but what I need help with is I want to have those substances that are removed from id number 3 also removed from other ids as well. I could do an algorithm like : for id in 1:2, if substance = c("abc","dgf") then delete but if the substances to be removed have long strings and are more than 2 (for example 20 substances) then it would take long time to list the substances manually. Can you guys please show me a clever way to do what I described above ?
   
  Another problem: Let's assume that we use the same data and do a box plot for each of the id and assume that there are two extreme outliers shown on the boxplot for id number 3 (probably the substances abc and dgf). I want to list the responses for these two substances for all ids and then make a profile plot for each substance across ids to check for the variation of response. Again if there are more than two substances and three ids then writting an algoritm like if substance = c("abc","dgf"), then list y may be inefficient. Any suggestion, please ?
  Thanks alot for your help,
  Jenny
   
   
   
  substance id block y 
  abc 1 1 2.5
  ade 1 1 2.2
  dfg 1 1 3.0
  ade 1 2 3.9
  glf 1 2 2.4
  wdg 1 2 2.8
  abc 1 3 3.4
  whl 1 3 4.2
  dgf 1 3 2.7
  abc 2 1 4.5
  ade 2 1 3.2
  dfg 2 1 3.0
  ade 2 2 3.2
  glf 2 2 2.0
  wdg 2 2 2.3
  abc 2 3 3.4
  whl 2 3 4.1
  dgf 2 3 2.5
  abc 3 1 4.0
  ade 3 1 3.0
  dfg 3 1 3.0
  ade 3 2 2.9
  glf 3 2 2.3
  wdg 3 2 2.8
  abc 3 3 3.1
  whl 3 3 2.8
  dgf 3 3 5.0

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


	[[alternative HTML version deleted]]

