Chopped roasted peanuts, for sprinkling
For the cupcakes: Preheat the oven to 350 degrees F. Line 24 muffin tins with paper liners.
Whisk the flour, baking soda, salt, cinnamon and nutmeg together in a medium bowl. Beat together the butter and granulated sugar using an electric mixer on medium-high speed until fluffy, about 3 minutes. Beat in the eggs, one at a time, and then the vanilla, beating until smooth.
Reduce the mixer speed to low and beat in half the flour mixture until just combined. Mix in the sour cream, and then add the rest of the flour. Beat until well combined, taking care not to overmix. Stir in the chopped apples.
Divide the batter among the prepared muffin tins, filling them halfway full. Bake until a toothpick inserted into the center of the cupcakes comes out clean and the tops spring back when pressed gently, about 20 minutes. Cool the cupcakes in the tin on a rack for 10 minutes and then remove from the tin and cool completely.
For the frosting: Beat the peanut butter, cream cheese and butter in a large bowl using an electric mixer on medium speed until smooth. Reduce the speed to low and beat in the confectioners' sugar until incorporated. Pipe or spread the frosting on the tops of the cupcakes and sprinkle with the peanuts.
When measuring flour, we spoon it into a dry measuring cup and level off the excess. (Scooping directly from the bag compacts the flour, resulting in dry baked goods.)