[R] Problems creating packages.

From: Robert Robinson <tehflash_at_gmail.com>
Date: Sat 24 Jun 2006 - 06:20:57 EST


I'm creating my own package for personal and I'm having trouble getting it to a point where R (v 2.3.1) will recognise it. I've followed two different tutorials for how to create the package structure and the DESCRIPTION file (
http://web.maths.unsw.edu.au/~wand/webcpdg/rpack.html , http://www.maths.bris.ac.uk/~maman/computerstuff/Rhelp/Rpackages.html#Lin-Lin ). I'm still getting errors where when I try to load the library in R by using library(samp) I get an error:

Error in library(samp) : 'samp' is not a valid package -- installed < 2.0.0?

And when I use the library() call I get this:

samp                    ** No title available (pre-2.0.0 install?) **

I'm not really sure where to go, I've looked throgh the huge document on how to create an R package on the site but that didn't help. Just for reference I'm going to add a sample of everything becasue at this point I really don't know what it is. Basic procedure is what they layout in the tutorials I linked above. First I made the files, followed by calling R CMD build samp on the samp directory that holds all my files, followed by calling sudo R CMD INSTALL samp_0.1-1.tar.gz  I don't get errors on either of those calls. When I call R CMD check samp I get this output:

Here is what my file structure looks like:

.:
DESCRIPTION man R

./man:

bootstrap.rd  hessian.rd         loglikelihood.rd  stdeviation6.rd
freq.rd       ks.rd              score6.rd         stdeviation.rd
hessian6.rd loglikelihood6.rd score.rd

./R:
bootsample.r hessian6.r loglikelihood6.r score6.r stdeviation.r firstlib.r hessian.r loglikelihood.r score.r freq.r ks.r Prob.r stdeviation6.r

here is what my DESCRIPTION file looks like:

Package: samp
Title: R custom simulation package
Version: 0.1-1
Date: 2006-06-23

Author: Cheng Peng <*********************>
Maintainer: ************** <tehflash@gmail.com> Description: Functions for custom simulation, includes a score and

        loglikelihood function.
License: GPL (version 2 or later)
Built: R 2.3.0; i686-pc-linux-gnu; 2006-06-16 11:28:36; unix Packaged: Fri Jun 16 11:36:02 2006; root

Here is a sample .r file format:

###########################################################################
#
#        Freq function returns the frequencies of numerical vectors
#
###########################################################################

  freq = function(x1,x2,x3){
     nn1=rep(0, length(x))
     nn2=rep(0, length(x))
     nn3=rep(0, length(x))
     for ( i in 1:length(x)){
         nn1[i]=sum(x[i]==x1)
         nn2[i]=sum(x[i]==x2)
         nn3[i]=sum(x[i]==x3)
     }

   mm = as.matrix(rbind(nn1,nn2,nn3))
   mm
  }

Here is a sample man page format:

\name{freq}
\alias{freq}
\title{Frequencies of numerical vectors}
\description{

   Freq function returns the frequencies of numerical vectors }
\usage{
freq(x1,x2,x3)
}
\arguments{

   \item{x1}{numerical vector}
   \item{x2}{numerical vector}
   \item{x3}{numerical vector}

}
\keyword{custom}

Thanks to anyone who can help me solve this.



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Jun 24 06:27:39 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 24 Jun 2006 - 08:14:39 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.