I have two matrices in a list:
colList <- list()
colList[["V1"]] <- as.matrix(c("asd", "asd", "asd"))
colList[["V2"]] <- as.matrix(c("das", "das", "das"))
And I want to cbind the values of a data.frame value.frame$keyID
to each sublist. The first value (2000) to the first sublist, the second value (3000) to the second sublist.
Here the value.frame:
value.frame <- data.frame(keyID =c("2000", "3000"))
The result should look like this:
colList <- list()
colList[["V1"]] <- matrix(c("asd", "asd", "asd", 2000, 2000, 2000),
nrow=3,
ncol=2)
colList[["V2"]] <- matrix(c("das", "das", "das", 3000, 3000, 3000),
nrow=3,
ncol=2)
I tried it with the following code, but the result is not the desired one. Hope someone can help me.
mapply( cbind, colList, paste(value.frame[,1]))