> y <- 1:4
> y
[1] 1 2 3 4
> names(y) <- c("a" "b" "c" "d")
错误: unexpected string constant in "names(y) <- c("a" "b""
> y
[1] 1 2 3 4
> y[2]
[1] 2
> names(y) <- ("a","b","c","d")
错误: 意外的',' in "names(y) <- ("a","
> y
[1] 1 2 3 4
y <- 1:4
names(y) <- c("a","b","c","d")
你这样试试,你的问题第一次是c函数中的没有逗号分隔,第二次是没有用c函数连接数据