To calculate an index in R, you can use a square bracket notation to subset a vector or a data frame. The index can be either a single value, a vector of values, or a logical vector.
Here are some basic examples:
main.r109 chars6 lines
Output:
main.r6 chars2 lines
main.r71 chars3 lines
Output:
main.r8 chars2 lines
main.r151 chars6 lines
Output:
main.r8 chars2 lines
These are just some basic examples of indexing. Depending on the data structure and the manipulation you need to perform, there are many other ways to use indexing in R.
gistlibby LogSnag