How to build an R package in Windows

Let’s suppose you ‘re in the mood to create an R package and then upload it to CRAN as an ideal way of making sure others have access to your work. I don’t know if the following guide will really help you cause the R package mechanism is rather complex, but I’m quite sure it’ll be better than nothing.

A. Toolbox (necessary pieces of software you have to install first)

0. Latest version of R.
1. rtools: a minimal set of Unix utilities
2. ActivePerl: a scripting language
3. MinGW: Compiler system, uses GCC to produce Windows programs
4. Microsoft’s HTML Compiler: It’s called htmlhelp.exe and includes hhc.exe
5. A version of TeX (I use MiKTeX)

B. Change your Windows Path “environmental variable”

To set the path, right click on the “My Computer” icon on your desktop. Choose properties and click on the “advanced” tab. Click the environmental variables button and you will see a new window. Change the system variable “Path”. To do so, click on the variable and select the edit button. Change the path so that the directories containing MikTeX, Rtools, minGW, perl, R and the html help compiler. You will need to be very careful to type the path names correctly. See below for an example of the beginning of the path as set on my machine:

C:\Perl\site\bin;C:\Perl\bin;C:\Program Files\R\R-2.10.1\bin;c:\Rtools\bin;c:\Rtools\MinGW\bin;c:\Perl\bin;C:\Program Files\MiKTeX 2.7\miktex\bin

Restart your machine.

C. Build your hello package (eventually)

- Open a “Command Prompt” window. Check if path is correct (type path).
- Run R through the command prompt (type R)
- Type package.skeleton("hello",code_="hello.r")
- Exit R (type q() )
(the hello directory was created and now you have to carefully edit the DESCRIPTION file which is under the hello directory and the hello.Rd file which is under the man directory, search for examples of these files in other package installations, you can find plenty of them in the lib directory, which is under your R installation directory)

- Back to the command prompt window, type R CMD build hello (hello.tar.gz was created)
- Type R CMD INSTALL --build hello (hello.zip was created)
- Type R CMD check hello for an extensive check of your package installation

In the unlikely event that everything went fine so far (no errors, no warnings) you just have to upload the hello.tar.gz file to ftp://cran.r-project.org/incoming/ and send an email to cran@r-project.org that you did it. Otherwise, google the bad news and hope for the best.

Other resources for building R packages:
[Making packages under Windows]
[Creating R packages: a tutorial]
[An introduction to the R package mechanism]
[Create packages for R]

Share this post: buzzdeliciousgooglefacebooktwitter

Στατιστική: Απλές συμβουλές για τα media

Όλα είναι Πολιτική — Tags: , — amarkos @ 11:38

[via] Statistical Modeling, Causal Inference, and Social Science

Thanks to Piled Higher and Deeper.

Share this post: buzzdeliciousgooglefacebooktwitter

ΑΣΠΑΙΤΕ

Εδώ και τρεις περίπου μήνες είμαι ένας ακόμα σπουδαστής στο ετήσιο πρόγραμμα παιδαγωγικής κατάρτισης της ΑΣΠΑΙΤΕ Θεσσαλονίκης. Ανάμικτες εντυπώσεις και προβληματισμοί δημιουργούνται μετά από κάθε εισήγηση. Johann Friedrich Herbart, Δημήτριος Γλυνός, Lev Vygotsky, Karl Marx, Sigmunt Freud και Jean Piaget παρελαύνουν και “συνομιλούν” σε μια προσπάθεια να’ ρθουμε πιο κοντά στην ουσία της εκπαιδευτικής λειτουργίας.

Περισσότερα

Στο blog του Δασκάλου μου Ανδρέα Οικονόμου

Από το αρχείο του 11ου Δημοτικού Σχολείου Καβάλας

Share this post: buzzdeliciousgooglefacebooktwitter
« Previous PageNext Page »
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2012 amarkos|gr|blog | powered by WordPress with Barecity