Читать книгу Probability with R - Jane M. Horgan - Страница 23
Example 1.1 Entering data from the screen to a vector
ОглавлениеThe total downtime occurring in the last month of 23 workstations in a computer laboratory was observed (in minutes) as follows:
To input these data from the screen environment of R, write
downtime <- c(0, 1, 2, 12, 12, 14, 18, 21, 21, 23, 24, 25, 28, 29, 30, 30, 30, 33, 36, 44, 45, 47, 51)
The construct is used to define a vector containing the 23 data points. These data are then assigned to a vector called downtime.
To view the contents of the vector, type
downtime
which will display all the values in the vector .
R handles a vector as a single object. Calculations can be done with vectors like ordinary numbers provided they are the same length.