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.
我有一个矢量图
vec <- c(1,2,3,4,5)
检索给定长度的所有子向量的最佳方法是什么?例如,所有长度为 3 的子向量将是:
1,2,3 2,3,4 3,4,5
感谢您的帮助!
试试这个:
k <- 3 embed(vec, k)[, k:1]