# Data Management : Vector indexing in R Language

A vector of positive integers (letters, and Letters return the 26 lowercase and uppercase letters, respectively). > letters [1 : 3]
 "a"  "b"  "c"

> letters [c(2,4,6) ]
  "b"  "d"  "f'"

> LETTERS [1 : 3]
  "A"  "B"  "C"

> LETTERS [ c(2,4,6) ]
  "B"  "D"  "E"

> letters
  "a"  "b"  "c"  "d"  "e"  "f"  "g"  "h"  "i"  "j"  "k"  "l"  "m"
 "n"  "o"  "p"  "q"  "r"  "s"  "t"  "u"  "v" "w"  "x"  "y"  "z"
>
> LETTERS
  "A"  "B"  "C"  "D"  "E"  "F"  "G"  "H"  "I"  "J"  "K"  "L"  "M"
  "N"  "O"  "P"  "Q"  "R"  "S"  "T"  "U"  "V"  "W"  "X"  "Y"  "Z"
>
> letters 
  "a"
>
> letters 
  "n"
>  Letters 
  "A"
> LETTERS 
  "N"
> letters [c(12,20,26) ]
  "1"  "t"  "z"

String vector
→ The elements of a vector can be named.
Using these names, we can access the vector elements.

names is used for functions to get or set the names of an object.
> z <- list (al = 1, a2 = "c" , a3 = 1 :3)
> z
\$al
  1
\$a2
  "c"
\$a3
 1 2 3

> names (z)
  "a1"  "a2"  "a3"

Matrices created from Lists

List can be heterogeneous (mixed modes).
We can start with a heterogeneous list, give it dimensions, and thus create a heterogeneous matrix that is a mixture of numeric and character data:
Example
> ab  <- list (1, 2, 3, "x", "y" , "z")
> dim(ab)  <- c(2,3)
> print(ab)
[,1]  [,2]  [,3]
[1,]   1     3      "y"
[2,]   2    "x"    "z"  