In R, we can use a file called .Rprofile to do things in R based on a number of triggers. One thing I’ve done is give myself a DIY notification of how many data breaches I’ve been involved in!
First of all, you need a file called .Rprofile that’s stored in your working directory. Some useful resources about .Rprofiles can be found on .Rprofile CRAN docs and an .Rprofile intro.
Now inside that file, you can add a number of functions that are based on a number of events like loading or closing R. I need a .First function for on load and whatever I produce has to be able to print to the console with cat().
With that in mind, instead of showing details, I chose to show the number of breaches I’m in. You can get HIBPwned from CRAN and use it to query the awesome website HaveIBeenPwned.com.
One thing that’s neat about the account_breach() function is that I can query multiple email addresses or user formats to get info. Here is my .Rprofile file that gives me notifications on load for data breaches: