R Data StructuresLesson 18Free preview
R Vectors
This lesson is part of R · All levels
Summary
This lesson is going into the vector, which is the most basic data structure in R. All the single scalar data in R is actually a one-dimensional vector. Developers will learn the making of vectors with c() or seq(), element naming, positive/negative indexing operations, as well as the long adjustment rule (recycling rule).
Key points
- Vectors are a collection of sequential elements with the same data type
- Vector indexes in R start with the number 1 (not 0)
- Indexing with a negative number (e.g.: v[-2]) will discard the element at that position
- The recycling rule automatically repeats shorter vector elements when operated with long vectors
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.