which() function is a generic function that returns the position of a logical object. The parameters of the function are: x : vector or array arr.ind : logical, to decide if the indices should be returned in an array ind : integer-valued index vector x = c ( 1 , 1 , 1 , 1 , 2 ) x ## [1] 1 1 1 1 2 which ( x == 2 ) ## [1] 5 summary ( chickwts ) ## weight feed ## Min. :108.0 casein :12 ## 1st Qu.:204.5 horsebean:10 ## Median :258.0 linseed :12 ## Mean :261.3 meatmeal :11 ## 3rd Qu.:323.5 soybean :14 ## Max. :423.0 sunflower:12 which ( chickwts $ feed == 'horsebean' ) ## [1] 1 2 3 4 5 6 7 8 9 10 which ( chickwts $ feed == 'soybean' ) ## [1] 23 24 25 26 27 28 29 30 31 32 33 34 35 36 x = matrix ( c ( 2 , 3 , 2 , 3 , 1 , 1 , 1 , 1 , 2 , 3 ) , ncol = 5 ) x ## [,1] [,2] [,3] [,4] [,5] ## [1,] 2 2 1 1 2 ## [2,] 3 3 1 1 3 #which are t...