Learn R Programming

Dasst (version 0.3.4)

[[<-: "[[<-" method for class '>Dasst

Description

"[[<-" sets the contents of a table from an object of class '>Dasst.

Arguments

x

An object of class '>Dasst.

i

An integer value. Position where values will be updated.

value

Any Values to be stored at the given position.

Value

The actual object of class '>Dasst.

Details

This method sets the contents of the selected table stored in an object of class '>Dasst. Tables are internally stored and retrieved as data.frame. Rules for subset can be applied.

See Also

[[

Examples

Run this code
# NOT RUN {
# Add a row of NA at the end of the table 1
data(plantGrowth)
rmax <- nrow(plantGrowth[[1]])
plantGrowth[[1]][rmax + 1, ] <- NA

# Edit a subset
plantGrowth[[1]][131:132,2:4]
plantGrowth[[1]][131:132,2:4] <- matrix(rep(100,6),nrow=2)
plantGrowth[[1]][131:132,2:4]

# Remove the last rows
# No need to subset left hand side. Dimension are automatically adjusted.
tail(plantGrowth[[1]])
plantGrowth[[1]] <- plantGrowth[[1]][c(-131,-132), ]
tail(plantGrowth[[1]])

# Column names are also valid
plantGrowth[[1]][129:130,"SNW1C"]
plantGrowth[[1]][129:130,"SNW1C"] <- 1100:1101
plantGrowth[[1]][129:130,"SNW1C"]
# }

Run the code above in your browser using DataLab