Hi there,
Welcome to the RStudio Community Forum.
I tried running that Rmarkdown code in both RStudio Cloud and in my own desktop RStudio under Windows 10 (after copy-paste into a new xxx.Rmd file) - it worked fine and produced the coloured volcano map, either by knitting the whole file (to HTML in my case), or by "playing" each chunk of R code. So, not sure what's going wrong.
Those colour palettes are defined in the {grDevices} package. If you run sessionInfo()
do you see grDevices listed under "attached base packages"?
Do you have a local experienced R user who might look over your shoulder and help?