【发布时间】:2021-01-24 23:29:29
【问题描述】:
我有一个向量,我想在另一个向量的基础上增加元素。
如何在无需手动输入的情况下增加向量中的元素?
我想使用这两个向量
NumberofTimes<-c(4,1,2,3)
Spread<-c(0.060,0.170,0.140,0.070)
```
I.e. I want a vector with 4 of the 0.060, 1 of the 0.170, 2 of the 0.140, etc.
Instead of writing:
```
Spread<-c(0.060,0.060,0.060,0.060,0.170,0.140,0.140,0.070,0.070,0.070)
```
【问题讨论】: