We studied the effect of anchoring groups on the conductance of single molecules using alkanes terminated with dithiol, diamine, and dicarboxylic-acid groups as a model system. We created a large number of molecular junctions mechanically and analyzed the statistical distributions of the conductance values of the molecular junctions. Multiple sets of conductance values were found in each case. The I-V characteristics, temperature independence, and exponential decay of the conductance with the molecular length all indicate tunneling as the conduction mechanism for these molecules. The prefactor of the exponential decay function, which reflects the contact resistance, is highly sensitive to the anchoring group, and the decay constant is weakly dependent on the anchoring group. These observations are attributed to different electronic couplings between the molecules and the electrodes and alignments of the molecular energy levels relative to the Fermi energy level of the electrodes introduced by different anchoring groups. For diamine and dicarboxylic-acid groups, the conductance values are sensitive to pH due to protonation and deprotonation of the anchoring groups. Further insight into the binding strengths of these anchoring groups to gold electrodes is obtained by statistically analyzing the stretching length of molecular junctions.