Learn R Programming

HonestDiD (version 0.2.6)

basisVector: Creates a standard basis vector.

Description

Creates a basis vector of length size with a 1 in the index position.

Usage

# Create the index basis vector in R^size
basisVector(index, size)

Value

Returns a basis vector of length size with a 1 in the index position.

Arguments

index

The index at which there should be a one. Default equals one.

size

The length of the vector. Default equals one.

Examples

Run this code
  # Create the first basis vector in R^2
  basisVector(index = 1, size = 2)
  # Create the third basis vector in R^6
  basisVector(index = 3, size = 6)

Run the code above in your browser using DataLab