But how does getting home from someone else’s hit count in the calculation of the batter’s stats?
That counts as a Run Scored (R) which is an important stat if the player is the kind of guy who’s known for getting a lot of hits and walks, or bases on balls (BB) and has speed (high OBP, in other words) but not a lot of power.
Batting average (BA or AVG): the percentage of times the batter makes a hit dived by the times at bat (instances where the batter was awarded a base because of four balls or an error and instances where the batter sacrificed--was called out but advanced the runner--are excluded from the count of “at bats"). At .300 batting average is considered very good. An average .400 is insanely great--the last man to achieve a .400 seasonal average was Ted Williams in 1941.
The batter is actually charged with a time at bat when he reaches base on an error. He’s not rewarded for a fielding mistake when he should’ve been out in the opinion of the official scorer.
Also, when you get into “park-adjusted stats” such as for ERA you’re getting into deep sabermetrics where only pros and real geeks live!