The reason regression is not symmetrical is because it specifically is minimizing the error between the regression line and the response variable, i.e. in the direction of the y-axis for y=ax and in the direction of the x axis for x=by. for a "symmetric" fit, you want to minimize errors orthogonal to the fit line. PCA does this. The fit line you are looking for well be the first principal component. Check out the built in R functions prcomp
and princomp
.
PCA will give you a vector that passes through your data with the symmetry property you are looking for and therefore you are getting the slope component of a simple linear regression, but it won't give you intercept term (because PCA is not typically used for this purpose). But you should be able to determine the intercept easily with the knowledge that the "regression" line will pass through $(\bar{x},\bar{y})$.