Requirements required for attaining an S-Rank seem to be a bit murky. There is a load screen tip that suggests that weapon and projectile percentages are the most important thing. However, in my experience, I have found what I feel to be a pretty good gauge on what is important.
Firstly, I think that carrots, time, and combo seem pretty irrelevant. Accuracy is definitely a big contributing factor. I found that a 60% accuracy or higher for each weapon set is pretty much a requirement for S-Rank. The other big thing is Health. I don't have an exact number (and it may vary from stage to stage), but I found that you can't have lost more than 100 health in a stage and still get an S-rank.
Most levels are not too tough honestly. The only level that is really giving me issues is 5-2: Throwing a Tantrum