We can multiply two or more vectors and can get the result as desired. Multiplication - Multiplication of Vectors in R. But rather, I can produce a vector that contains elements that can be consecutive at times, yet I only want the first element in the sequence of consecutive elements. The elements are not always the first, fourth, and sixth indices. :1.1800 NA's :1.0000 STKCC RTKCC LFMGCC STMGCC Min. In the above example, the elements I would want are 636 24639 48640. Creating a vector using: operator We can create a Vector using a colon (:) operator. rv <- c (11, 21, 19) cat (length (rv)) Output 3 It counts the number of elements in the Vector. It combines each element of the first vector with the corresponding element of the second vector and gives a output TRUE if both the elements are TRUE. :1.7600 (Other):36 NA's :11.00 STBM RTBM LFNCC STNCC Min. To check the length of a Vector in R, use the length () function. It is called Element-wise Logical AND operator.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |