Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试构建一个给定数字向量和向量限制的函数,它会找到第一个向量的元素所属的范围。
如果我有一个看起来像这样的向量
numbers<-c(3,10,4,6,1)
和一个限制向量,例如
limits<-c(2,5,7,12)
结果是
1,3,1,2,NA
到目前为止,我已经尝试过which或match运气不佳。
which
match