If that sample is large enough, and selected properly, it will represent the whole well enough for most purposes. But, instead of using scientifically rigorous representative samples, unscrupulous researchers often use small, carefully selected, non-representative samples, so that they can build their bias into the study from the very start. Then, by using data from those unrepresentative samples, they extrapolate their conclusions to the whole. Apples are high in pectin, and low in Vitamin C. Oranges, on the other hand, are higher in Vitamin C, and lower in pectin. New Medical Studies Prove Apples Are Just As Good A Source of Vitamin C as Oranges Are.
Honest researchers take into account the entire shipment.
Dishonest ones generally don't. This trick is often camouflaged by a wealth of impressive, but irrelevant, statistics cited within a study. For example, it is always darker on each successive 3rd Thursday between the months of October and December. Sometimes, finding the truth can seem an almost impossible task. Sometimes, it's a matter of one person's word against another, with no other witnesses to help set the record straight.