RMarkdown: Alr4 and dplyr problems

I have a new RMarkdown project with output to pdf. I’m using the twins dataset from alr4 library. As I execute chunks of code inline the output is fine.

When I try to knit I get error of missing packages and unknown datasets (dplyr and alr4 are not loading).

I tried to use pacman (which worked in R and the packages allowed me access to alr4 and the twins dataset) but it’s equivalent is not working in RMarkdown.

I’ve tried creating a new session; tried loading chunk at beginning of code; and of course Restarting session and restarting R altogether.

Any ideas would be really appreciated!

Hi,

Please do share a reproducible example so that we are able to know what you've done and how.

FAQ: How to Format R Markdown Source