1.4 Generating a sequence and a factorIn order to compute so-called quantiles of distributions (see e.g. Section 2.1.4) or plots of functions, we need to generate sequences of numbers. The easiest way to construct a sequence of numbers is by> 1:5 [1] 1 2 3 4 5 5We mention in particular: http://faculty.ucr.edu/~tgirke/Documents/R_BioCond/R_BioCondManual.html 6The argument of functions is always placed between parenthesis ().1.5. COMPUTING ON A DATA VECTOR 5This sequence can also be produced by the function seq, which allows for various sizes of steps to be chosen. For instance, in order to compute percentiles of a distribution we may want to generate numbers between zero and one with step size equal to 0.1.> seq(0,1,0.1) [1] 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0For plotting and testing of hypotheses we need to generate yet another type of sequence, called a “factor”. It is designed to indicate an experimental condition of a measurement or the group to which a patient belongs.7 When, for instance, for each of three experimental conditions there are measurements from five patients, the corresponding factor can be generated as follows.> factor <- gl(3,5) > factor [1] 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 Levels: 1 2 3The three conditions are often called “levels” of a factor. Each of these levels has five repeats corresponding to the number of observations (patients) within each level (type of disease). We shall further illustrate the idea of a factor soon because it is very useful for purposes of visualization.
การแปล กรุณารอสักครู่..