Problem with length()

val here is a length-1 vector. I suspect you meant to call length(first(val)) or length(only(val))

1 Like