Skip to contents

Chainable functional alias of x[, j] <- value.

Usage

setCol(x, j, value)

Arguments

x

An object that supports the "[<-" method, such as a matrix or data frame.

j

Column index

value

The value to assign to the specified index/indices.

Value

The modified object.

See also

Examples

mat <- matrix(1:9, nrow = 3)
setCol(mat, j = 2, value = 5)  # Set entire second column to 5
#>      [,1] [,2] [,3]
#> [1,]    1    5    7
#> [2,]    2    5    8
#> [3,]    3    5    9