Robert F. Kennedy Jr. was sworn in Thursday as health secretary after a close Senate vote, putting the prominent vaccine skeptic in control of $1.7 trillion in federal spending.