Could you please turn this into a self-contained reprex (short for reproducible example)? It will help us help you if we can be sure we're all working with/looking at the same stuff.
If you run into problems with access to your clipboard, you can specify an outfile for the reprex, and then copy and paste the contents into the forum.
So, you don't actually make a reprex by calling the reprex library — it's something you run on the code itself that allows other people to run your code as well. Nick Tierney's magic reprex article will take you through the process quickly:
Or, if you prefer video, Jenny gives a brief overview of it in her webinar here:
It looks like you've filed an issue (helpful, since it's hard to figure out from the existing documentation what's going wrong). We just ask that you also post the issue to your community thread, so that others who may run into the same issue can follow along, too.
Okay so it acts really differently when I do it the way shown in the video! In that I encounter a different error (that is 'Error in hmd.mx'), this error doesn't happen when run in the console.
It looks like this has to do with not being able to connect to the data source you're trying to use:
#> Error in hmd.mx("CAN", "username", "password", "Canada"): Connection error at www.mortality.org. Please check username, password and country label.
As a result, you don't create that first object which, then, doesn't exist for any of your subsequent analysis. You might have better luck if you can create a small example that doesn't use a remote data source, or re-create a piece of the data that you're pulling locally for the purposes of the reprex.