Graph Your Net Worth Using R

Interested in making net worth progress graphs that look just like mine? Do you also want an introduction to computer programming in R? Well, what a coincidence, this post will cover both of those things! Read on to learn how to graph your net worth using R!

Why R?

I think that R is one of the best languages for learning how to program, especially if you want to work with data. It’s easy to read, has a big following online who can answer questions for you, and it’s open source aka free!

Below, I broke down the process of making net worth graphs in R into a series of 10 very basic steps. All you need is a computer, and this should take less than 20 minutes.

So, get your numbers handy and get ready for a free new skill and a satisfying financial nerd-tastic graph. Go for it!

When I read this intro back to myself it sounds super gimmicky, sort of infomercial-like, but no one’s making any money off you downloading R or using my template. I’m just proselytizing R users because I think it’s a great language and I like to use it for graphing my net worth!

1. Download R

This first step is the hardest, but it’s still seriously pretty easy.

It’s free to download R. If you run Windows on your computer, click “Download R 3.3.2 for Windows” at this link:

If you use a Mac, go to and choose either “R-3.3.2.pkg” or “R-3.2.1-snowleopard.pkg” depending on which version of Mac OS X you’re working with.

Open the .exe file that you’ve downloaded and click “Next” or “OK” or “Finish” through all the default settings to install R.

Boom! First step done!

2. Open R

The default installation process added a shortcut to your desktop for R. Click on it to open R.

graph net worth using R
What the icon looks like on my black desktop
graph net worth using R
What opens when you click on the R icon

(See, this is seriously not hard!)

3. Start a new R script (that’s the fancy name for a program you write in R)

You open a new R script like you would open a new Microsoft Word document. Choose “New Script” from the File menu.

graph net worth using R

The window that pops up is called the Editor. It’s where you write R scripts.

4. Copy and paste this code 

Here’s the script I use to graph my net worth. Copy it and paste it into your newly opened editor window.

Tip: If you mouse over this code snippet, a toolbar will appear at the top with a copy icon that makes it even easier to copy this code.

5. Add in your goals

See where there’s an all-caps comment in my code that says “PUT YOUR GOAL DOLLAR VALUES AND CORRESPONDING DATES HERE”? Do that!

Your goals are net worth values that you want to reach by certain dates.

In this example code, I pretended that I wanted to get to $100k by January 1, 2015; $200k by January 1, 2016; $300k by January 1, 2017; etc.

Put your goal net worth values in between the parentheses in line 8, as plain numbers separated by commas.

Put the corresponding dates you want to reach each one by between the parentheses in lines 9 and 10, separated by commas. These dates should be formatted “yyyy-mm-dd” and each one should be within quotation marks.

6. Save your script

Just seemed like this would be a good time to remind you to save.

While you’re using the Editor window, click the Save icon on the toolbar like you would save basically any other file.

7. Add in your net worth progress


Same as before. Lines 13-14. You want dollar values of what your net worth was at certain times, along with corresponding dates.

In the imaginary situation shown in my example code, I had $100k on January 1, 2015 and $300k on August 31, 2015.

And why not click save again for good measure. I save my script compulsively when I’m coding.

8. The title

On line 17, it says title = “…”. Between those quotation marks, fill in whatever title you want to show up at the top of your graph. If you don’t want a title, just put title = “”.

9. The filepath

You’ll want to save your lovely net worth graph to somewhere on your computer! Check out line 21 of my code.

Put the filepath of the location you want the plot saved to there between the quotation marks. It should end with whatever you want the name of your plot to be. My example is named “goalplot.png”.

Important tip: Make sure you replace any backslashes in the filepath with forward slashes. R likes them better!

10. Run it!

You don’t have to mess with any of the code below line 22. Just leave it alone, unless you already conquered the basics and you want to fiddle around.

Now highlight all of your R code and type “Ctrl-R”. Boom! You ran it!

You can also run the code by choosing "Run All" from the Edit menu.
You can also run the code by choosing “Run All” from the Edit menu.

Your shiny new plot should be saved wherever you told R to put it! Go check it out, you creator!

graph your net worth using R
Here’s the example plot that results from using the code above


(Optional) Download RStudio

The images in this post have been of the RGui setup, which is the default way to use R. However, there’s a much prettier way!

If you think you’d like to use R more than just for this, you should definitely download RStudio. It’s a free (for individuals) integrated development environment (IDE) that will keep all the windows from overlapping, color code your script, and let you click on tables to view them in actual tabular form.

graph your net worth using R
RStudio: the editor window is on the top left, on the top right I can click on any objects I create and view them, and on the bottom right I can view my plot or search for the “Help” documentation for certain functions.


Hope you try this out and it’s helpful to you! If you want to know how to add in a tweak you want, or if you’re getting an error and you can’t understand why, let me know! Do you like to graph differently in R? Let me know! You can comment here, email me, or find me on reddit as /u/misschedda.

I’d also love to see your graph if you made one using this code! Happy net worth growing!

8 thoughts on “Graph Your Net Worth Using R”

    1. No, it’s not! Did you notice that two of the steps are literally clicking on the R icon and saving your work?!

      I know that some people have a natural aversion to any programming, but I hoped that people would overcome it if I broke the process down into tiny steps. One day when you’re supremely bored or suffering from insomnia you should try it out! 🙂

    1. Cool! R Studio is definitely the way to go! The R GUI layout just annoys my sense of organization so much. I hate how the windows overlap and leave open space between each other, but I thought it would be easier for a new-to-R person to start off with.

      I have a fantasy of eventually writing an FI-purposed program in every language I know, but we’ll see how long that takes me 🙂

      It’s neat to find another R lover in the FI world!

  1. This is awesome, thanks for sharing the tutorial! I’m a Python aficionado myself but my dear friend has been nagging me to try using R for ages. I think your pretty chart finally convinced me to try it!

    1. Come over to the dark side! Just kidding–I’m used to writing in R but I’m trying to get more comfortable with Python.

      Also I just looked through your knitting patterns and I’m really into the Trellis Top. I’ve never knit anything that big, though!

Leave a Reply

Your email address will not be published. Required fields are marked *