Page 222 - Data Science class 11
P. 222
Following result is produced:
If the last element of the sequence is by mistake mentioned out of range, then it will be discarded as shown below:
Example
Enter the following code snippet:
V<- 5.5: 12.7
print(V)
The following result is produced:
6.7.1 sequence operator
Using the sequence operator, you can create a vector with elements between two numbers, the values of which are
incremented by a numerical figure.
Example
Enter the following code snippet:
x <- seq(6, 10, by = 0. 5)
print(x)
The above code snippet displays all numbers from 6 to 10 at an interval of 0.5 each. Results from the code run above:
6.7.2 to create a vector using the arguments provided
Another way of creating a vector is to use the c function. Here, the default method combines the arguments provided
to form a vector. Here, all the arguments are forced to a common type, which is the returned value type. The return
type is determined by the highest type of the components in the hierarchy expression: > list > character > complex
> double > integer > logical > raw > NULL.
#The logical and numeric values are corrected to characters.
220 Touchpad Data Science-XI

