index.returnlogical indicating if the ordering index vector should be returned as wellthis is only available for a few cases, the default na.last = NA and full sorting of non-factors.
假设 第一组数据是 a1 第二组数据是a2, 他们的行数是一致的!
index<- is.na(a1)a1[index] <- a2[index]
# here is a example
a1<-c(1,NA,3,NA,5,6,NA,8,9,10)
a1
a2<- 1:10
a2
length(a1)
length(a2)
index<-is.na(a1)
a1[index]<-a2[index]
a1
结果截图:
不知道是不是你想要的结果~
如果你能提供数据结构的话,我或许可以更加明确的提供方法!