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.
我想在 R. 伪代码中有固定长度/维度向量/矩阵:
foo <- fixed_character(LETTERS, length = 26) foo <- LETTERS[1:10] # throws an error, wrong length bar <- fixed_matrix(NA, 6, 2) bar <- matrix(1:12, 3, 4) # wrong dimensions
这对于捕获错误和编写健壮的代码很有用。CRAN 上是否有任何软件包可以做到这一点?
我记得rtype系统允许您在分配时检查向量和数据框的维度。vctrs包似乎也很相关。