R Package Creating

Oct 21, 2009

Here is a better and more updated version for creating or translating algorithms from other packages to R.

2009

Dated 5 April

These are part of the still un named Translator Package.

Note this has many bugs and is un released for production.

Also I belive there is no standardization in R language – there are multiple instances of the function describe across various packages and that leads to confusion- �…the term describe is confusing too ……….as in describe what…

standardized language syntax can help make R easier.

It should be simplified to be self explanatory you can not be confused with functions named freq or means for example.

Npte this is a WIP so do mail me syntax suggestions.

Source-http://www.nceas.ucsb.edu/scicomp/GISSeminar/UseCases/CreateRPackageWithC/CreateRPackageWithC.html

Creating a New R Package: Four Steps

  1. Create the ‘R-callable’ version of your high-level language function by creating a new argument list for the function.
  2. Prepare the required components of an installable R package:�/src�and�/R�folders containing the C code and R script developed in Steps 1 and 2),
    a�/man�folder containing a standard ‘help’ file for each R function in the package, and DESCRIPTION and NAMESPACE files used by the�
    R package-building software.
  3. Configure your computer with the appropriate R package software development tools.
  4. Construct the R package using the R commands�R CMD check�and�R CMD build (R CMD install –build on Windows XP platforms)

Once the package is constructed, you can install and test it within R on compatible computer platforms using the R�install.packages()�function.

Downloadable examples from this use case:

Click�here�to the complete R package source and directory structure for this Use Case�(Windows and Linux)

Download the installable R package demonstrated here:�Linux�OR�Windows XP�platforms.

End of Quote

Restarting syntax for India1.0 Package �(tentative name for this time)

(where x is name of dataset or in SAS syntax ……..data =x)

procfreq(x)<- function(x) table(x)

procprint(x)<- function(x) print(x)

procunivariate(X)<-function(X)�library(Hmisc)�describe(X)

procreg(y,x1,x2,x3)<-function(x) lm(y ~x1,x2,x3)

Dated�March 3rd, 2009

Dear All,

I am doing some research into creating a R Package for SAS language Users.

The name of the beta package is � Anne�, but I am open to suggestions for the name please.

The basic idea is to enable SAS language Users (especially Windows SAS language� users) to get a feel to try out the R package without getting overwhelmed with the matrix level powerful capabilities as well as command line interface.

Creating new functions is quite easy as the following code shows.

The first R code for the �Anne 1.0� Package is

procunivariate(x) <- function(x) summary(x)

procimportcsv(x) <- function(x) read.table(x,header=TRUE,

�������������������������� + sep=�,�, row.names=�id�, na.string=��� �)

libname(Y) <-function(Y) setwd(Y)

Note I am tweaking the code as we speak and would be trying to add one proc per week.

But how to put functions in a R Package ?

This is how to create a R package �(�To be Continued)

Note- SAS here refers to SAS Language.

This page is an ongoing page for research related to creating a SAS Language Wrapper for the R Software to establish a middleware package.

Names Suggested till now

  • Ursas � � � � � � � � � � � Barry Rowlingson

. U-R-SAS. �(pun on You Are�SAS, or You�R-SAS)

�2. Ur-SAS. (Germanic prefix Ur- meaning ‘proto’ or ‘primitive’)[1]

�3. Ursas (from Latin ‘Ursa’ meaning ‘bear’, because it seems very few
R�users can bear�SAS)

Barry

[1]�http://en.wiktionary.org/wiki/ur-

  • SASsieR – � � � � � � � � Jim Lemon
  • RforSAS
  • procR

One Response to R Package Creating

  1. Pingback: Friday OT: Eclectic

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 )

Twitter picture

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

Facebook photo

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

Connecting to %s