为什么这样做:
tb4 <- names(tibble(c("O","H","L","V","P")))
names(tb4)<-"nms4"
str(tb4)
Named chr "c(\"Open\",\"High\",\"Low\",\"Volume\",\"prev_day_open_int\")"
- attr(*,"names")= chr "nms4"
但不是这样:
tb3 <- {names(tibble(c("O","P")))<- "nm3"}
Error in names(tibble(c("Open","High","Low","Volume","prev_day_open_int"))) <- "nm3" :
target of assignment expands to non-language object.
还是这个?
tb3 <- (names(tibble(c("O","P")))<- "nm3")
相同的错误。