I'd like to have fixed length/dimensions vectors/matrices in R. Pseudocode:
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
This would be useful for catching errors and writing robust code. Are there any packages on CRAN that do this?