Ten Steps to Building an R package under Windows

If you’ve spent any amount of time working in R there comes a point when you want to create your own package in R.  I’ve switched back and forth between running R on my MAC and running it on Windows and I thought I’d give package development on Windows a try.  What I’ll try to do on these pages is document that process step by step for the raw beginner.

First off, I need to thank all the R experts who have help put all the tools and documentation in place. Without them none of this would be possible.

How to Build a Package in Windows

Use the guide below to jump to any section you want. I’ll take you through the entire process as I did it.

Step One:  Update your R and other Tools. We will start by updating our version of R and I’ll update my current version of RStudio. Neither of these steps are difficult and you can just skip this section as you should already be familiar with these types of tasks.

Step  Two: Get to know your Windows System

Step Three:  Decide which kind of package  you want to build

Step Four:  Get the tools

Step Five:   Installing the tools

Step Six:  Fixing your Path

Step Seven: Reboot and do some reading

Step Eight;  The Sample Package

Step Nine: Edit some files

Step Ten: Build

Advertisement
  1. David McKeever
    October 9, 2011 at 1:23 PM

    Very interesting and informative. I was wondering if you think that someone (like me) could download comma separated files (.csv) from a horse racing website that has data from past performances using your build steps. I would be interested in doing things like time series, and econometric techniques applied to horse racing. Any comments appreciated.

  2. steven mosher
    October 9, 2011 at 8:50 PM

    yes, but you dont need to build a package. Just get R and download the file

  3. Oleg M
    December 18, 2011 at 4:37 AM

    This is very helpful. I am making my first steps trying to build C code into my R programs. Most other places (like R documentation on CRAN) skip a lot of these, for example the nature of R CMD. Thank you Steve!

  4. Dinesh
    May 2, 2012 at 3:55 AM

    This is the best ever documentation for creating “R packages using Windows”. Simple and to the point. Thanks Steve. This was very helpful.

    • Steven Mosher
      May 2, 2012 at 3:57 AM

      you are welcomed. Let others know if they have problems

  5. January 18, 2013 at 2:40 PM

    Hello to every one, for the reason that I am really keen
    of reading this webpage’s post to be updated regularly. It includes nice information.

  6. July 16, 2013 at 10:12 PM

    Its such as you learn my mind! You seem to understand so much approximately
    this, such as you wrote the ebook in it or something.
    I think that you just could do with a few % to power the message house a little bit,
    but other than that, this is fantastic blog. An excellent read.
    I will definitely be back.

  7. October 18, 2013 at 8:10 PM

    Hi Steve, thanks for the tutorial. I followed your ways and edited the path carefully. However, when I ran “R CMD build mypkg” in command prompt, it said “C:\ Program is not recognized as an external….”. I tried to fix this problem by surfing online, but still got stuck on this. Do you have any idea on this. Thanks!!!

  8. October 27, 2013 at 8:13 AM

    Hi! I found your tutorial very useful. I am writing my dissertation about a package I published thanks to this tutorial. I will acknowledge your work on it. Thank you!

    • Steven Mosher
      October 28, 2013 at 2:04 AM

      Wow thank you

  9. March 20, 2014 at 10:09 PM

    Asking questions are really nice thing if you are not understanding something
    totally, but this paragraph presents fastidious understanding even.

  10. August 7, 2014 at 11:04 PM

    Because the discs are absorbing shock with movement, you would be in pain all day if your discs could cause you pain. They can either soak in a
    nice hot tub of water, or allow warm water from the shower
    to massage the sore area. Daily exercise is
    the key to avoid lower back pain left side or any other strains on your
    muscles.

  11. September 16, 2014 at 3:39 PM

    Nice offer. This offer is really attractive to all. personally I like it.
    windows 7 download

  12. October 6, 2014 at 7:10 PM

    Hey just wantewd to give you a quick heads up.
    The text in your article ssem too be running
    off thee screen in Chrome. I’m not sure if this is a formatting issuee or
    something to do with browser compatibility butt I thought I’d post to
    let you know. The deseign and style look great
    though! Hope you get thhe problem resolved soon. Cheers

  13. jjgasse
    May 25, 2015 at 3:28 PM

    Hello everyone, I would like to ask a question about the construction of a packae in R.
    The functions to be implemented in the package are supported of course other packages.
    How do I import the latter in my package? Excuse my ignorance but is the first time I approach the building of a package.
    Thanks in advance

  14. August 10, 2015 at 6:21 AM

    I too am getting ‘BUILD’ is not recognized as an internal or external command. Thank you for the tutorial but there is definitely missing information. My Environment path is correct. This whole process is completely painless on Linux folks, it takes literary minutes on Ubuntu to not only install the R environment but to also build a package. Unfortunately binary compatibility with packages is not supported (apparently not even if 100% of the code in your package is R code). The authors of R appear to have no regard for Windows developers whatsoever. It’s a real shame.

  15. te
    March 24, 2016 at 10:38 PM

    Awesome!!!

  16. January 22, 2017 at 3:49 AM

    Zrim: Richard, what Geoff asked for was an example from Scripture of a dramatic conversion experience in line with the expectations of promoters of revival (of children or otherwise), not of ordinary conversion. All you provided are examples of the latter.RS: Not so, sir. What I said is just below:RS (old comment disputed by Zrim): The only people that we know that were converted are those that heard the Word and God gave them new life. Many of those were Gentiles. We do know this, however, Jesus told Nicodemus that he must be born from above to enter the kingdom. Jesus told the apostles themselves (in different ways, Mat 18:3 as an example) that they must be turned and become like children to enter the kingdom. We know that the promises of Acts 2 were for the children of believers, but what were those promises and what was “the condition” for receiving those promises?RS (present): My position is that the only conversions we have recorded are those who heard the Word and God gave them life. In other words, whether children or not the only ones we know about are those God gave life to. My example from Acts 2 had to do with the fact that the promise of the Holy Spirit was to the elect as well. The example from Matthew 18:3 is also a text that speaks of the work of God in the soul.Zrim: And I don’t see how Jesus saying one must be born from above and become as a little child makes the case for a dramatic conversion. Obviously no anti-revivalist would disagree with Jesus, but how Spirit wrought conversion props up revival-o-sity isn’t clear.RS: But I don’t believe in revival-o-sity so I don’t want to prop it up. What I am arguing is that each person, whether from a believing family or not, must be born from above. You can think of that as a dramatic conversion, but that is not the point that I am trying to make. Whether child or adult a person must be born again. I would not argue that it has to be dramatic, but if it is that is no argument that it is not authentic. I also don’t believe that God can dwell in people and that they cannot tell that something is different. I am not saying that they must know the day or hour or even month, but at some point a person should know that something is different in them. If the Gospel is the power of God to save, then can it be that the power of God in a person is not seen by that person or others at some point?GW also said this: “The Evangelist Timothy seems to have been one scriptural example of a child coming to faith through the ordinary covenant nurture/means of grace paradigm.” My argument is that a child will only come to faith by the new birth paradigm and the new birth is not ordinary in any sense. John 1:12-13 says this: “12 But as many as received Him, to them He gave the right to become children of God, even to those who believe in His name, 13 who were born, not of blood nor of the will of the flesh nor of the will of man, but of God.”RS: All those that received Christ were those who believed in His name. Why did they believe? Not because they were born to a certain group of parents, not because they were born according to the will of their father nor the will of any person (including their own), but because of the will of God. “JACOB I LOVED, BUT ESAU I HATED” is true of two covenantal children. It is not because Jacob was better or Esau was worse, but because God chose. It was not because Jacob willed or ran, but because God chose. It was not because Isaac chose, but because God chose. No one comes to faith (whether a child or an adult or whether from believing parents or non-believing parents) according to anything but the sovereign mercy and grace of God.LikeLike

  17. Thomas Moyer
    March 30, 2020 at 4:06 AM

    Wow, looks great, especially the end. I was looking for this particular topic for a couple of days across the nest,
    but there was nothing precious, only discovered this https://guitarlesonworld.com/dont-let-a-lack-of-funding-be-the-reason-you-miss-out-on-college/, but still so pleased to reach your post in the
    end. I’m keen on that theme, and I need to be always conscious of
    the most recent news. That is a joy to read your post and eventually clarify myself.

  18. Rios Zoe
    June 14, 2020 at 5:31 AM

    I have read some associated with your works previously
    but this 1 is just brilliant. Right now there
    are not many materials I might recommend to every person. The
    last time it had been https://www.facebook.com/pg/essayservicecom/reviews/. Plus I
    will certainly want all my close friends to read your work as well.
    Thanks a lot a lot, this was an actual enjoyment.

  19. Miller Vincent
    July 7, 2020 at 1:48 PM

    Веб-сайт https://essaypro.money/ – партнерка в нише
    написания академических работ.
    Есть немного лендингов, своя трекинг
    система, полноценный суппорт и райтеры.
    Заточена под англоязычный рынок.

  1. June 9, 2011 at 12:20 AM
  2. May 23, 2012 at 9:17 PM
  3. August 11, 2012 at 8:53 PM
  4. March 2, 2013 at 5:03 AM
  5. June 22, 2014 at 9:32 PM
  6. September 9, 2015 at 12:18 AM
  7. January 20, 2022 at 8:16 AM
  8. December 17, 2022 at 7:24 AM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: