Added check of SEXPTYPE

* src/rmatio.c (map_R_object_rank_and_dims): Added check of SEXPTYPE of
  the R object to make sure LENGTH are used on an expected type. Added
  doxygen documentation.