I’d conjecture that even though sex and fecal swear words are on the rise in books, racial slurs are going down. I have no data other than the fact that most people I know avoid swearing in public because they think other people are offended by it. But they avoid racial slurs because those words are just offensive.