我正在尝试使用以下代码复制站号 24 次:
stnid <- NULL
for (i in 1:24) {
stnid[i] <- rep(paste0("station",i),times=24)
}
> stnid
[1] "station1" "station2" "station3" "station4" "station5" "station6" "station7" "station8" "station9"
[10] "station10" "station11" "station12" "station13" "station14" "station15" "station16" "station17" "station18"
[19] "station19" "station20" "station21" "station22" "station23" "station24"
但是,我收到警告说:
> warnings()
Warning messages:
1: In stnid[i] <- rep(paste0("station", i), times = 24) :
number of items to replace is not a multiple of replacement length
2: In stnid[i] <- rep(paste0("station", i), times = 24) :
number of items to replace is not a multiple of replacement length
3: In stnid[i] <- rep(paste0("station", i), times = 24) :
number of items to replace is not a multiple of replacement length
4: In stnid[i] <- rep(paste0("station", i), times = 24) :
number of items to replace is not a multiple of replacement length
5: In stnid[i] <- rep(paste0("station", i), times = 24) :
number of items to replace is not a multiple of replacement length
6: In stnid[i] <- rep(paste0("station", i), times = 24) :
number of items to replace is not a multiple of replacement length
7: In stnid[i] <- rep(paste0("station", i), times = 24) :
number of items to replace is not a multiple of replacement length
8: In stnid[i] <- rep(paste0("station", i), times = 24) :
number of items to replace is not a multiple of replacement length
9: In stnid[i] <- rep(paste0("station", i), times = 24) :
number of items to replace is not a multiple of replacement length
10: In stnid[i] <- rep(paste0("station", i), times = 24) :
number of items to replace is not a multiple of replacement length
11: In stnid[i] <- rep(paste0("station", i), times = 24) :
number of items to replace is not a multiple of replacement length
12: In stnid[i] <- rep(paste0("station", i), times = 24) :
number of items to replace is not a multiple of replacement length
13: In stnid[i] <- rep(paste0("station", i), times = 24) :
number of items to replace is not a multiple of replacement length
14: In stnid[i] <- rep(paste0("station", i), times = 24) :
number of items to replace is not a multiple of replacement length
15: In stnid[i] <- rep(paste0("station", i), times = 24) :
number of items to replace is not a multiple of replacement length
16: In stnid[i] <- rep(paste0("station", i), times = 24) :
number of items to replace is not a multiple of replacement length
17: In stnid[i] <- rep(paste0("station", i), times = 24) :
number of items to replace is not a multiple of replacement length
18: In stnid[i] <- rep(paste0("station", i), times = 24) :
number of items to replace is not a multiple of replacement length
19: In stnid[i] <- rep(paste0("station", i), times = 24) :
number of items to replace is not a multiple of replacement length
20: In stnid[i] <- rep(paste0("station", i), times = 24) :
number of items to replace is not a multiple of replacement length
21: In stnid[i] <- rep(paste0("station", i), times = 24) :
number of items to replace is not a multiple of replacement length
22: In stnid[i] <- rep(paste0("station", i), times = 24) :
number of items to replace is not a multiple of replacement length
23: In stnid[i] <- rep(paste0("station", i), times = 24) :
number of items to replace is not a multiple of replacement length
24: In stnid[i] <- rep(paste0("station", i), times = 24) :
number of items to replace is not a multiple of replacement length
谁能解释我在这里做错了什么?谢谢。
预期的:
每个站从站 1 到站 24 各 24 次。