unable to replace a vector in a list R

user12197328 :

So im trying to print all the elements in the first vector by 15 but at the end I get the error "number of items to replace is not a multiple of replacement length in R", why is this?

v1 <- c(1:10)
v2 <- c("R Programming")
v3 <- c("XML")

lvst <- list(v1,v2,v3)
names(lvst) <- c("v1","v2","v3")
print("Original list:")
lvst

print("New list - First Element:")
lvst[1] <- (v1 * 15)
Shubham Pujan :

Is this what you want :

> lvst[[1]]*15

 [1]  15  30  45  60  75  90 105 120 135 150

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=376085&siteId=1