Analysis of magnetic interactions and structure in R6Mn23