Preheat the oven to 350°F (175°C) and line a muffin tin with cupcake liners.
In a bowl, whisk together flour, baking powder, baking soda, salt, cinnamon, and nutmeg.
In a separate large bowl, beat vegetable oil, granulated sugar, and brown sugar until well combined.
Add eggs and vanilla extract, mixing until smooth.
Gradually add the dry ingredients to the wet mixture, stirring just until combined.
Fold in grated carrots, walnuts, and raisins if using.
Divide the batter evenly among the cupcake liners, filling each about 3/4 full.
Bake for 18-20 minutes or until a toothpick inserted in the center comes out clean.
Let the cupcakes cool in the pan for 5 minutes before transferring to a wire rack to cool completely.
Prepare the frosting by beating cream cheese and butter together until smooth. Gradually add powdered sugar and vanilla extract, mixing until creamy.
Frost the cooled cupcakes and enjoy!