The R-matrix method is implemented to study the heavy charm and bottom diquark, triquark, tetraquark, and pentaquarks in configuration space, as the bound states of quark-antiquark, diquark-quark, diquark-antidiquark, and diquark-antitriquark systems, respectively. The mass spectrum and the size of these systems are calculated for different partial wave channels. The calculated masses are compared with recent theoretical results obtained by other methods in momentum and configuration spaces and also by available experimental data.