The r horizon, also known as the bedrock layer, is the deepest layer of soil that consists of unweathered rock. This layer plays a crucial role in soil formation as it provides the parent material from which soil develops, influencing the characteristics of overlying soil horizons and affecting drainage, nutrient availability, and plant growth.