When using negative integral vectors, R removes the denoted elements and returns the remaining as the result. Code: > negint_vec <- vec[c(-2,-4)] > negint_vec. Output: 4. Character indexing vectors. We use a character vector, only to index vector
7.1. Indexing With Logicals ¶. We first give an example of how to select specific items in a vector. The first step is to define a vector of data, and the second step is to define a vector made up of logical values.
Accessing Vector Elements. Elements of a Vector are accessed using indexing. The [ ] brackets are used for indexing. Indexing starts with position 1. Giving a negative value in the index drops that element from result.TRUE, FALSE or 0 and 1 can also be us
Post a Comment:
Showing 0 Comments: