Could you reformat your question as a reproducible example (reprex)? A reprex makes it much easier for others to understand your issue and figure out how to help. A lack of a reprex just makes it much less likely others will reply.
Here's how to format your code chunk: FAQ: How to make your code look nice? Markdown Formatting
Be sure to include the error messages or issues you're facing.
Your code above runs for me, but deviates from the example linked.