From patrick.giraudoux at univ-fcomte.fr  Mon May  5 08:50:04 2008
From: patrick.giraudoux at univ-fcomte.fr (Patrick Giraudoux)
Date: Mon, 05 May 2008 08:50:04 +0200
Subject: [Rd] troubles with R CMD check and examples under Ubuntu gutsy
In-Reply-To: <20080505143209.2d1dfc86@berwin-nus1>
References: <481E94DF.9000004@univ-fcomte.fr>	<20080505135549.5a3503d8@berwin-nus1>	<481EA601.2000803@univ-fcomte.fr>
	<20080505143209.2d1dfc86@berwin-nus1>
Message-ID: <481EAE1C.5020204@univ-fcomte.fr>

Berwin A Turlach a ?crit :
> G'day Patrick,
>
> On Mon, 05 May 2008 08:15:29 +0200
> Patrick Giraudoux <patrick.giraudoux at univ-fcomte.fr> wrote:
>
>   
>> Berwin A Turlach a ?crit :
>>     
>
>   
>>> But I have compiled R on my boxes myself.  How did you install R?
>>> >From source or by using the prepackaged Ubuntu deb files?
>>>   
>>>       
>>  From the pre-packaged Ubuntu, updated to 6.7.0 recently ? Do you
>> think it may come from this ?
>>     
>
> Could be possible, but I would find it hard to believe.  But it raises
> the question which pre-packaged packages have you all installed.  Your
> package pgirmess seems to have quite a few dependencies (which I had
> to install first on my machine before I could run R CMD check).  But
> that could be a red herring too, since the problem seems to be that the
> command PermTest is not found while the code in the examples are run.
>   
There has been a threat on something similar in R-devel on August 
2007...  but I cannot understand the meaning.
> Did you look at the file in pgirmess.Rcheck that I mentioned?  
You'll find a copy of pgirmess-Ex.R, but I cannot get what is the 
meaning of this file...
> Also,
> did you try to load the version of the library in pgrimess.Rcheck in a
> R session and check if you find the PermTest function in that case?
>   
Yes indeed. I found PermTest in the R folder and in the R-ex folder of 
the pgirmess folder in the pgirmess.Rcheck folder.
>  
> With these problems, I am a bit of a trial-and-error person, so if I
> cannot reproduce the error, I cannot find out what the problem is....
>
> Cheers,
> 	
> 	Berwin
>
>
>   
Thanks anyway for the hints. It may help.
>   





### * <HEADER>
###
attach(NULL, name = "CheckExEnv")
assign("nameEx",
       local({
       s <- "__{must remake R-ex/*.R}__"
           function(new) {
               if(!missing(new)) s <<- new else s
           }
       }),
       pos = "CheckExEnv")
## Add some hooks to label plot pages for base and grid graphics
assign("base_plot_hook",
       function() {
           pp <- par(c("mfg","mfcol","oma","mar"))
           if(all(pp$mfg[1:2] == c(1, pp$mfcol[2]))) {
               outer <- (oma4 <- pp$oma[4]) > 0; mar4 <- pp$mar[4]
               mtext(sprintf("help(\"%s\")", nameEx()), side = 4,
                     line = if(outer)max(1, oma4 - 1) else min(1, mar4 - 1),
               outer = outer, adj = 1, cex = .8, col = "orchid", las=3)
           }
       },
       pos = "CheckExEnv")
assign("grid_plot_hook",
       function() {
           grid::pushViewport(grid::viewport(width=grid::unit(1, "npc") -
                              grid::unit(1, "lines"), x=0, just="left"))
           grid::grid.text(sprintf("help(\"%s\")", nameEx()),
                           x=grid::unit(1, "npc") + grid::unit(0.5, 
"lines"),
                           y=grid::unit(0.8, "npc"), rot=90,
                           gp=grid::gpar(col="orchid"))
       },
       pos = "CheckExEnv")
setHook("plot.new",     get("base_plot_hook", pos = "CheckExEnv"))
setHook("persp",        get("base_plot_hook", pos = "CheckExEnv"))
setHook("grid.newpage", get("grid_plot_hook", pos = "CheckExEnv"))
assign("cleanEx",
       function(env = .GlobalEnv) {
       rm(list = ls(envir = env, all.names = TRUE), envir = env)
           RNGkind("default", "default")
       set.seed(1)
          options(warn = 1)
       .CheckExEnv <- as.environment("CheckExEnv")
       delayedAssign("T", stop("T used instead of TRUE"),
          assign.env = .CheckExEnv)
       delayedAssign("F", stop("F used instead of FALSE"),
          assign.env = .CheckExEnv)
       sch <- search()
       newitems <- sch[! sch %in% .oldSearch]
       for(item in rev(newitems))
               eval(substitute(detach(item), list(item=item)))
       missitems <- .oldSearch[! .oldSearch %in% sch]
       if(length(missitems))
           warning("items ", paste(missitems, collapse=", "),
               " have been removed from the search path")
       },
       pos = "CheckExEnv")
assign("ptime", proc.time(), pos = "CheckExEnv")
## at least one package changes these via ps.options(), so do this
## before loading the package.
## Use postscript as incomplete files may be viewable, unlike PDF.
## Choose a size that is close to on-screen devices, fix paper
ps.options(width = 7, height = 7, paper = "a4", reset = TRUE)
grDevices::postscript("pgirmess-Ex.ps")
             
assign("par.postscript", graphics::par(no.readonly = TRUE), pos = 
"CheckExEnv")
options(contrasts = c(unordered = "contr.treatment", ordered = 
"contr.poly"))
options(warn = 1)   
library('pgirmess')

assign(".oldSearch", search(), pos = 'CheckExEnv')
assign(".oldNS", loadedNamespaces(), pos = 'CheckExEnv')
cleanEx(); nameEx("PermTest")
### * PermTest

flush(stderr()); flush(stdout())

### Name: PermTest
### Title: Permutation test for lm, lme and glm (binomial and Poisson)
###   objects
### Aliases: PermTest PermTest.lm PermTest.lme PermTest.glm print.PermTest
### Keywords: htest

### ** Examples

library(MASS)
mylm<-lm(Postwt~Prewt,data=anorexia)
PermTest(mylm,B=250)

## Dobson (1990) Page 93: Randomized Controlled Trial :
    counts <- c(18,17,15,20,10,20,25,13,12)
    outcome <- gl(3,1,9)
    treatment <- gl(3,3)
    glm.D93 <- glm(counts ~ outcome + treatment, family=poisson)
    PermTest(glm.D93,B=250)

library(nlme)
fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1)
PermTest(fm2,B=250)

 


cleanEx(); nameEx("Segments")
### * Segments

flush(stderr()); flush(stdout())

### Name: Segments
### Title: Draw line segments between pairs of points.
### Aliases: Segments
### Keywords: hplot

### ** Examples

 mydata<-cbind(rnorm(20),rnorm(20),rnorm(20),rnorm(20))
 plot(range(rbind(mydata[,1],mydata[,3])),range(rbind(mydata[,2],mydata[,4])),type="n",xlab="",ylab="")
 Segments(mydata,col=rainbow(20))
 
 myvec<-rnorm(4)
 plot(myvec[c(1,3)],myvec[c(2,4)],type="n",xlab="",ylab="")
 Segments(myvec)
 
 myvec<-rnorm(16)
 plot(myvec,myvec,type="n",xlab="",ylab="")
 Segments(myvec)
 


cleanEx(); nameEx("TukeyHSDs")
### * TukeyHSDs

flush(stderr()); flush(stdout())

### Name: TukeyHSDs
### Title: Simplify the list of a TukeyHSD object keeping the significant
###   differences only.
### Aliases: TukeyHSDs
### Keywords: htest

### ** Examples


     summary(fm1 <- aov(breaks ~ wool + tension, data = warpbreaks))
     myobject<-TukeyHSD(fm1, "tension", ordered = TRUE)
     myobject
     TukeyHSDs(myobject)
 


cleanEx(); nameEx("ci")
### * ci

flush(stderr()); flush(stdout())

### Name: CI
### Title: Confidence interval of percentages
### Aliases: CI
### Keywords: htest

### ** Examples


x<-c(2,10,7,8,7) # eg: number of positive cases
y<-c(56,22,7,20,5)# eg: number of negative cases
CI(x,y)

x<-c(2,10,7,8,7) # eg: number of positive cases
y<-c(4,11,7,16,10)# eg: total number of cases
CI(x,y,totrials=TRUE)




cleanEx(); nameEx("classnum")
### * classnum

flush(stderr()); flush(stdout())

### Name: classnum
### Title: Gives an index vector of the class category of each value of a
###   numerical vector
### Aliases: classnum print.clnum
### Keywords: misc

### ** Examples

x<-rnorm(30)
classnum(x)
classnum(x,breaks="fd")
classnum(x, breaks=c(-1,0,1))
classnum(x,breaks=5)



cleanEx(); nameEx("cormat")
### * cormat

flush(stderr()); flush(stdout())

### Name: cormat
### Title: Gives a correlation matrix and the probability of Ho for each
###   correlation
### Aliases: cormat
### Keywords: htest

### ** Examples

cormat(longley)
cormat(longley,sep=TRUE)



cleanEx(); nameEx("correlog")
### * correlog

flush(stderr()); flush(stdout())

### Name: correlog
### Title: Computes Moran's or Geary's coefficients on distance classes
### Aliases: correlog plot.correlog print.correlog
### Keywords: spatial

### ** Examples


library(spdep)
data(oldcol)
attach(COL.OLD)
coords<-cbind(X,Y)
res<-correlog(coords,CRIME)
plot(res)

res<-correlog(coords,CRIME,method="Geary")
plot(res)




cleanEx(); nameEx("deg2dec")
### * deg2dec

flush(stderr()); flush(stdout())

### Name: deg2dec
### Title: Convert degree minutes coordinates into decimal degrees (1.60 =
###   2)
### Aliases: deg2dec
### Keywords: manip

### ** Examples


deg2dec(c(1,1.3,1.6))




cleanEx(); nameEx("diag2edge")
### * diag2edge

flush(stderr()); flush(stdout())

### Name: diag2edge
### Title: Computes the edge of a square from its diagonal
### Aliases: diag2edge
### Keywords: dplot spatial

### ** Examples


# diagonal sloping up
coord<-matrix(c(20,20,90,90),nr=2,byrow=TRUE)
plot(coord,type="n",xlim=c(0,100),ylim=c(0,110),asp=1)
lines(coord,lty=2)
# square edge
lines(diag2edge(coord),col="red")

# diagonal sloping down
coord<-matrix(c(20,90,90,20),nr=2,byrow=TRUE)
plot(coord,type="n",xlim=c(0,100),ylim=c(0,110),asp=1)
lines(coord,lty=2)
# square edge
lines(diag2edge(coord),col="red")

# diagonal vertical
coord<-matrix(c(20,90,20,20),nr=2,byrow=TRUE)
plot(coord,type="n",xlim=c(0,100),ylim=c(0,110),asp=1)
lines(coord,lty=2)
# square edge
lines(diag2edge(coord),col="red")




cleanEx(); nameEx("difshannonbio")
### * difshannonbio

flush(stderr()); flush(stdout())

### Name: difshannonbio
### Title: Empirical confidence interval of the bootstrap of the difference
###   between two Shannon indices
### Aliases: difshannonbio
### Keywords: misc

### ** Examples

data(preybiom)
attach(preybiom)
jackal<-preybiom[site=="Y" & sp=="C",5:6]
genet<-preybiom[site=="Y" & sp=="G",5:6]

difshannonbio(jackal,genet,R=150)
 


cleanEx(); nameEx("dirProj")
### * dirProj

flush(stderr()); flush(stdout())

### Name: dirProj
### Title: Computes new coordinates given bearings and distances.
### Aliases: dirProj
### Keywords: spatial

### ** Examples


df<-data.frame(x1=0,y1=0,alpha=runif(3,0,380),d=runif(3,0,1))
df
plot(-1:1,-1:1,type="n")
points(0,0,pch=19)
points(dirProj(df))
text(dirProj(df)[,1],dirProj(df)[,2],1:3,pos=4)



cleanEx(); nameEx("dirSeg")
### * dirSeg

flush(stderr()); flush(stdout())

### Encoding: latin1

### Name: dirSeg
### Title: Computes segment directions.
### Aliases: dirSeg
### Keywords: spatial

### ** Examples


x2<-rnorm(10)
y2<-rnorm(10)
mydata<-cbind(0,0,x2,y2)
dirs<-dirSeg(mydata)
dirs

plot(range(mydata[,c(1,3)]),range(mydata[,c(2,4)]),type="n")
Segments(mydata)
text(mydata[,3],mydata[,4],paste(round(dirs,0),"?"),cex=0.7)
 


cleanEx(); nameEx("distNode")
### * distNode

flush(stderr()); flush(stdout())

### Name: distNode
### Title: Computes the distances between each nodes of a polyline.
### Aliases: distNode
### Keywords: spatial

### ** Examples

x<-c(10,56,100)
y<-c(23,32,150)
distNode(cbind(x,y))



cleanEx(); nameEx("distPolylines")
### * distPolylines

flush(stderr()); flush(stdout())

### Name: distPolylines
### Title: Computes the length of each lines of an output (polylines) of
###   'read.shape' from maptools.
### Aliases: distPolylines
### Keywords: spatial

### ** Examples


 # see example of Norwegian rivers in library maptools: ?Map2lines
 library(maptools)
 
 try4 <- read.shape(system.file("shapes/fylk-val.shp", 
package="maptools")[1])
 
 distPolylines(try4)




cleanEx(); nameEx("distSeg")
### * distSeg

flush(stderr()); flush(stdout())

### Name: distSeg
### Title: Computes distances between the top coordinates of segments.
### Aliases: distSeg
### Keywords: spatial

### ** Examples

x1<-rnorm(20)
y1<-rnorm(20)
x2<-rnorm(20)
y2<-rnorm(20)
mydata<-cbind(x1,y1,x2,y2)
distSeg(mydata)



cleanEx(); nameEx("distTot")
### * distTot

flush(stderr()); flush(stdout())

### Name: distTot
### Title: Computes the total length of a polyline.
### Aliases: distTot
### Keywords: spatial

### ** Examples

x<-c(10,56,100)
y<-c(23,32,150)
distTot(cbind(x,y))
 


cleanEx(); nameEx("distTotshp")
### * distTotshp

flush(stderr()); flush(stdout())

### Name: distTotshp
### Title: Computes the total length of the lines of an output of
###   'read.shape' from maptools.
### Aliases: distTotshp
### Keywords: spatial

### ** Examples


 # see example of Norwegian rivers in library maptools: ?Map2lines
 library(maptools)
 
 try4 <- read.shape(system.file("shapes/fylk-val.shp", 
package="maptools")[1])
 
 distTotshp(try4)




cleanEx(); nameEx("expandpol")
### * expandpol

flush(stderr()); flush(stdout())

### Name: expandpoly
### Title: Homothetia (size expansion) of a polygon
### Aliases: expandpoly
### Keywords: manip

### ** Examples


x<-c(-5,-4.5,0,10,5)
y<-c(-10,0,5,5,-8)
poly<-cbind(x,y)
plot(-10:20,-20:10,type="n")
polygon(poly)
polygon(expandpoly(poly,1.5),border="red")
polygon(expandpoly(poly,0.5),border="blue")




cleanEx(); nameEx("friedmanmc")
### * friedmanmc

flush(stderr()); flush(stdout())

### Name: friedmanmc
### Title: Multiple comparisons after Friedman test
### Aliases: friedmanmc
### Keywords: htest

### ** Examples

  data(siegelp179)
  attach(siegelp179)
 
  friedman.test(score,treatment,block)
  friedmanmc(score,treatment,block)
  friedmanmc(score,treatment,block,probs=0.01)
 
  mymatrix<-matrix(score,nc=3)
  friedman.test(mymatrix)
  friedmanmc(mymatrix)
 



cleanEx(); nameEx("kruskalmc")
### * kruskalmc

flush(stderr()); flush(stdout())

### Name: kruskalmc
### Title: Multiple comparison test after Kruskal-Wallis
### Aliases: kruskalmc
### Keywords: htest

### ** Examples

resp<-c(0.44,0.44,0.54,0.32,0.21,0.28,0.7,0.77,0.48,0.64,0.71,0.75,0.8,0.76,0.34,0.80,0.73,0.8)
categ<-as.factor(rep(c("A","B","C"),times=1,each=6))
kruskalmc(resp, categ)
kruskalmc(resp, categ, probs=0.01)
kruskalmc(resp, categ, cont="one-tailed")
kruskalmc(resp, categ, cont="two-tailed")




cleanEx(); nameEx("ks.gof")
### * ks.gof

flush(stderr()); flush(stdout())

### Name: ks.gof
### Title: Kolmogorof-Smirnov goodness of fit test to normal distribution
### Aliases: ks.gof
### Keywords: htest

### ** Examples

x<-rnorm(50)
ks.gof(x)
 


cleanEx(); nameEx("pairsrp")
### * pairsrp

flush(stderr()); flush(stdout())

### Name: pairsrp
### Title: Produces a matrix of scatterplot, regression coefficient and
###   p(Ho)
### Aliases: pairsrp
### Keywords: hplot

### ** Examples

data(iris)
pairsrp(iris[,1:4],meth="pears",pansmo=TRUE,abv=TRUE)
 


cleanEx(); nameEx("pave")
### * pave

flush(stderr()); flush(stdout())

### Name: pave
### Title: Provide square polygons or their node coordinates along a
###   segment
### Aliases: pave
### Keywords: dplot spatial

### ** Examples


# segment sloping up
coord<-matrix(c(20,20,90,90),nr=2,byrow=TRUE)
plot(coord,type="n",xlim=c(0,100),ylim=c(0,110),asp=1)
lines(coord)
# point grids
gr<-pave(coord,20,4,output="points") # y decreasing
points(gr)
gr<-pave(coord,20,4,output="points",ydown=FALSE) # y increasing
points(gr,col="blue")
# square polygon grids
gr<-pave(coord,20,4) # y decreasing
for (i in 1:length(gr)) polygon(gr[[i]])
gr<-pave(coord,20,4,ydown=FALSE) # y increasing
for (i in 1:length(gr)) polygon(gr[[i]],border="blue")

# segment sloping down
coord<-matrix(c(20,90,90,20),nr=2,byrow=TRUE)
plot(coord,type="n",xlim=c(0,100),ylim=c(0,110),asp=1)
lines(coord)

# point grids
gr<-pave(coord,20,4,output="points")  # y decreasing
points(gr)
gr<-pave(coord,20,4,output="points",ydown=FALSE) # y increasing
points(gr,col="blue")

# fixed edge
plot(coord,type="n",xlim=c(0,100),ylim=c(0,110),asp=1)
lines(coord)
gr<-pave(coord,20,4,fix.edge=4,output="points")
points(gr,col="blue")

plot(coord,type="n",xlim=c(0,100),ylim=c(0,110),asp=1)
lines(coord)
gr<-pave(coord,20,4,fix.edge=5.5,output="points")
points(gr,col="red")

# square polygon grids
coord<-matrix(c(20,90,90,20),nr=2,byrow=TRUE)
plot(coord,type="n",xlim=c(0,100),ylim=c(0,110),asp=1)
lines(coord,lwd=2)
gr<-pave(coord,20,4)# y decreasing
for (i in 1:length(gr)) polygon(gr[[i]])
gr<-pave(coord,20,4,ydown=FALSE) # y increasing
for (i in 1:length(gr)) polygon(gr[[i]],border="blue")

## Not run:
##D # Writing a polygon shapefile
##D gr<-pave(coord,20,4,output="spdf") # y decreasing
##D library(maptools)
##D writePolyShape(gr, "myshapefilename")
## End(Not run)




cleanEx(); nameEx("pclig")
### * pclig

flush(stderr()); flush(stdout())

### Name: pclig
### Title: Compute the percentage of each cell of a matrix or data.frame by
###   row
### Aliases: pclig
### Keywords: array

### ** Examples

x<-c(2,10,7,8,7)
y<-c(56,22,7,20,5)
pclig(cbind(x,y))



cleanEx(); nameEx("permcont")
### * permcont

flush(stderr()); flush(stdout())

### Name: permcont
### Title: Random permutation of a contingency table n row x 2 columns
### Aliases: permcont
### Keywords: distribution

### ** Examples

tab<-cbind(n1=c(10,12,8,7,5),n2=c(4,5,8,10,12))
tab
permcont(tab)



cleanEx(); nameEx("piankabio")
### * piankabio

flush(stderr()); flush(stdout())

### Name: piankabio
### Title: Computes the Pianka's index of niche overlap
### Aliases: piankabio
### Keywords: misc

### ** Examples


data(preybiom)
attach(preybiom)
jackal<-preybiom[site=="Y" & sp=="C",5:6]
genet<-preybiom[site=="Y" & sp=="G",5:6]

piankabio(jackal,genet)
 



cleanEx(); nameEx("piankabioboot")
### * piankabioboot

flush(stderr()); flush(stdout())

### Name: piankabioboot
### Title: Bootstrap Pianka's index
### Aliases: piankabioboot
### Keywords: htest

### ** Examples

data(preybiom)
attach(preybiom)
jackal<-preybiom[site=="Y" & sp=="C",5:6]
genet<-preybiom[site=="Y" & sp=="G",5:6]

piankabioboot(jackal,genet,B=100)
 



cleanEx(); nameEx("plot.variogenv")
### * plot.variogenv

flush(stderr()); flush(stdout())

### Name: plot.variogenv
### Title: Plots empirical variogram and its envelop
### Aliases: plot.variogenv
### Keywords: spatial

### ** Examples

library(gstat)
data(meuse)
myvar<-variogenv(log(zinc)~1, loc=~x+y, meuse)
plot(myvar)




cleanEx(); nameEx("polycirc")
### * polycirc

flush(stderr()); flush(stdout())

### Name: polycirc
### Title: Computes the polygon coordinates of a circle
### Aliases: polycirc
### Keywords: manip

### ** Examples

plot(1:10,1:10,type="n",asp=1)
polygon(polycirc(5),col="blue")
polygon(polycirc(2,c(5,5)), col="red")




cleanEx(); nameEx("polycirc2")
### * polycirc2

flush(stderr()); flush(stdout())

### Name: polycirc2
### Title: Computes the polygon coordinates of a circle sector
### Aliases: polycirc2
### Keywords: dplot

### ** Examples

plot(c(-1,+1),c(-1,+1),type="n",asp=1)
polygon(polycirc2(),col="red")
polygon(polycirc2(init=pi,angle=pi/4),col="green")
polygon(polycirc2(init=1.5*pi,angle=pi/4),col="violet")
polygon(polycirc2(radius=0.5,center=c(0.5,1)),col="blue")

polycirc2(init=pi,angle=pi/4)



cleanEx(); nameEx("postxt")
### * postxt

flush(stderr()); flush(stdout())

### Name: postxt
### Title: Computes coordinates defined from their relative position on x
###   and y in the plotting region
### Aliases: postxt
### Keywords: dplot

### ** Examples


plot(rnorm(30),rnorm(30),type="n")
text(postxt("ul"),"here",pos=4)
text(postxt("ur"),"here again",pos=2)
text(postxt("bc"),"again and again")




cleanEx(); nameEx("print.mc")
### * print.mc

flush(stderr()); flush(stdout())

### Name: print.mc
### Title: print method for objects of class 'mc'
### Aliases: print.mc
### Keywords: print

### ** Examples

resp<-c(0.44,0.44,0.54,0.32,0.21,0.28,0.7,0.77,0.48,0.64,0.71,0.75,0.8,0.76,0.34,0.80,0.73,0.8)
categ<-as.factor(rep(c("A","B","C"),times=1,each=6))
kruskalmc(resp, categ)



cleanEx(); nameEx("rmls")
### * rmls

flush(stderr()); flush(stdout())

### Name: rmls
### Title: Select objects in the parent frame and remove them.
### Aliases: rmls
### Keywords: utilities

### ** Examples


toremove<-NULL
ls()
    ## Not run:
##D         rmls()# select the object 'toremove' and click OK
##D    
## End(Not run)
ls()




cleanEx(); nameEx("selMod")
### * selMod

flush(stderr()); flush(stdout())

### Name: selMod
### Title: Model selection according to information theoretic methods
### Aliases: selMod selMod.lm selMod.glm selMod.list
### Keywords: models

### ** Examples

 library(MASS)
 anorex.1 <- lm(Postwt ~ Prewt*Treat, data = anorexia)
 selMod(anorex.1)
 anorex.2 <- glm(Postwt ~ Prewt*Treat, family=gaussian,data = anorexia)
 selMod(anorex.2)
 anorex.3<-lm(Postwt ~ Prewt+Treat, data = anorexia)
 mycomp<-selMod(list(anorex.1,anorex.2,anorex.3))
 mycomp
 attributes(mycomp)$models



cleanEx(); nameEx("shannon")
### * shannon

flush(stderr()); flush(stdout())

### Name: shannon
### Title: Computes Shannon's and equitability indices
### Aliases: shannon
### Keywords: misc

### ** Examples


x<-c(0.1,0.5,0.2,0.1,0.1)
sum(x)
shannon(x)

x<-rpois(10,6)
shannon(x, proba=FALSE)




cleanEx(); nameEx("shannonbio")
### * shannonbio

flush(stderr()); flush(stdout())

### Name: shannonbio
### Title: Computes Shannon's and equitability indices from a data frame of
###   dietary analysis (n, biomass,...)
### Aliases: shannonbio
### Keywords: misc

### ** Examples


data(preybiom)
shannonbio(preybiom[,5:6])




cleanEx(); nameEx("shannonbioboot")
### * shannonbioboot

flush(stderr()); flush(stdout())

### Name: shannonbioboot
### Title: Boostrap Shannon's and equitability indices
### Aliases: shannonbioboot
### Keywords: htest

### ** Examples

data(preybiom)
myboot<-shannonbioboot(preybiom[,5:6],B=100)
boot.ci(myboot, index=1,type=c("norm","basic","perc")) # confidence 
intervals for H'
boot.ci(myboot, index=2,type=c("norm","basic","perc")) # confidence 
intervals for J'



cleanEx(); nameEx("siegelp179")
### * siegelp179

flush(stderr()); flush(stdout())

### Name: siegelp179
### Title: Data on rats training
### Aliases: siegelp179
### Keywords: datasets

### ** Examples

data(siegelp179)



cleanEx(); nameEx("tabcont2categ")
### * tabcont2categ

flush(stderr()); flush(stdout())

### Name: tabcont2categ
### Title: Convert a contingency table (data.frame) into a presence/absence
###   table of categories
### Aliases: tabcont2categ
### Keywords: array

### ** Examples

mydata<-as.data.frame(matrix(rpois(9,5),nr=3,nc=3))
names(mydata)<-LETTERS[1:3]
row.names(mydata)<-letters[1:3]

tabcont2categ(mydata)



cleanEx(); nameEx("trans2pix")
### * trans2pix

flush(stderr()); flush(stdout())

### Name: trans2pix
### Title: Convert a transect coordinate file with some landmarks into a
###   matrix with intermediate coordinates.
### Aliases: trans2pix
### Keywords: utilities

### ** Examples


x<-c(10,NA, NA, NA,56,NA,NA,100)
y<-c(23,NA, NA, NA,32,NA,NA,150)
cols=c("red","blue","blue","blue","red","blue","blue","red")
plot(x,y,col=cols,pch=19)
plot(trans2pix(cbind(x,y)),col=cols,pch=19)




cleanEx(); nameEx("trans2seg")
### * trans2seg

flush(stderr()); flush(stdout())

### Name: trans2seg
### Title: Convert a transect coordinate file into a matrix with segment
###   coordinates.
### Aliases: trans2seg
### Keywords: utilities

### ** Examples


x<-c(10,NA, NA, NA,56,NA,NA,100)
y<-c(23,NA, NA, NA,32,NA,NA,150)
cols=c("red","blue","blue","blue","red","blue","blue","red")
plot(x,y,col=cols,pch=19)
mysegs<-trans2seg(cbind(x,y))
segments(mysegs[,1],mysegs[,2],mysegs[,3],mysegs[,4])



cleanEx(); nameEx("val4symb")
### * val4symb

flush(stderr()); flush(stdout())

### Name: val4symb
### Title: Centres a numerical vector on a parameter position and provides
###   absolute values and colors according to negative and positive values
### Aliases: val4symb
### Keywords: color dplot

### ** Examples

x<-rnorm(30)
y<-rnorm(30)

z<-val4symb(rnorm(30))
symbols(x,y,circle=z$size,inches=0.2,bg=z$col)

z<-val4symb(scale(rnorm(30)))
symbols(x,y,circle=z$size,inches=0.2,bg=z$col)

z<-val4symb(rnorm(30),col=c("green","violet"))
symbols(x,y,circle=z$size,inches=0.2,bg=z$col)

z<-val4symb(rnorm(30),trim=0.025)
symbols(x,y,circle=z$size,inches=0.2,bg=z$col)

z<-val4symb(rnorm(30),median)
symbols(x,y,circle=z$size,inches=0.2,bg=z$col)

myfun<-function(x) 20 # passes an arbitrary constant
z<-val4symb(1:30,myfun)
symbols(x,y,circle=z$size,inches=0.2,bg=z$col)




cleanEx(); nameEx("valat")
### * valat

flush(stderr()); flush(stdout())

### Name: valat
### Title: Expected values of a contingency table under the null hypothesis
### Aliases: valat
### Keywords: array

### ** Examples

x <- matrix(c(12, 5, 7, 7), nc = 2)
x
valat(x)



cleanEx(); nameEx("valchisq")
### * valchisq

flush(stderr()); flush(stdout())

### Name: valchisq
### Title: Values of the partial chi-square in each cell of a contingency
###   table
### Aliases: valchisq
### Keywords: array

### ** Examples

x <- matrix(c(12, 5, 7, 7), nc = 2)
x
valchisq(x)



cleanEx(); nameEx("variogenv")
### * variogenv

flush(stderr()); flush(stdout())

### Name: variogenv
### Title: Envelops for empirical variograms based on permutations
### Aliases: variogenv
### Keywords: spatial

### ** Examples

library(gstat)
data(meuse)
myvar<-variogenv(log(zinc)~1, loc=~x+y, meuse)
myvar
plot(myvar)




cleanEx(); nameEx("write.arcGrid")
### * write.arcGrid

flush(stderr()); flush(stdout())

### Name: write.arcGrid
### Title: Writes an ArcInfo ASCII grid from a matrix or data frame, with
###   x, y, z values.
### Aliases: write.arcGrid
### Keywords: utilities

### ** Examples

library(splancs)
data(bodmin)  
mykernel<-kernel2d(as.points(bodmin), bodmin$poly, h0=2, nx=100, ny=100)
attributes(mykernel$z)<-NULL
mykernel$z[is.na(mykernel$z)]<--9999
mydata<-cbind(expand.grid(mykernel$x,mykernel$y),mykernel$z)
write.arcGrid(mydata,file="mytextgrid",NODATA=-9999)



cleanEx(); nameEx("write.cl2grass")
### * write.cl2grass

flush(stderr()); flush(stdout())

### Name: write.cl2grass
### Title: Convert the output of contourLines into a ascii GRASS vector
###   file (lines).
### Aliases: write.cl2grass
### Keywords: utilities

### ** Examples

 x<-1:nrow(volcano)
 y<-1:ncol(volcano)
 contour(x, y, volcano)
 mycontours<-contourLines(x, y, volcano)
 write.cl2grass(mycontours, "volcanocont")
 # check the new files "volacnocont.txt" and "volacnocontlev.txt"in the 
working directory
 


cleanEx(); nameEx("write.delim")
### * write.delim

flush(stderr()); flush(stdout())

### Name: write.delim
### Title: Write a data.frame
### Aliases: write.delim
### Keywords: utilities

### ** Examples

 data(preybiom)
 write.delim(preybiom[1:10,]) # output to the console
 write.delim(preybiom[1:10,],file="Myfile.txt") # write a file in the 
working directory
 
 


cleanEx(); nameEx("write.kernel2points")
### * write.kernel2points

flush(stderr()); flush(stdout())

### Name: write.kernel2points
### Title: Write a text file of X,Y coordinates and Z value from the output
###   of 'kernel2d' (library splancs)
### Aliases: write.kernel2points
### Keywords: utilities

### ** Examples

    library(splancs)
    data(bodmin)
    mykernel<-kernel2d(as.points(bodmin), bodmin$poly, h0=2, nx=100, ny=100)
    write.kernel2points(mykernel, "mypoints")



cleanEx(); nameEx("write.pts2grass")
### * write.pts2grass

flush(stderr()); flush(stdout())

### Name: write.pts2grass
### Title: Convert a matrix of points coordinates (x,y) into an ascii GRASS
###   vector file (lines).
### Aliases: write.pts2grass
### Keywords: utilities

### ** Examples

x<-rnorm(30)
y<-rnorm(30)
write.pts2grass(cbind(x,y),"myfile.txt")
# check the new file "myfile.txt"in the working directory
 



### * <FOOTER>
###
cat("Time elapsed: ", proc.time() - get("ptime", pos = 'CheckExEnv'),"\n")
grDevices::dev.off()
###
### Local variables: ***
### mode: outline-minor ***
### outline-regexp: "\\(> \\)?### [*]+" ***
### End: ***
quit('no')



[Rd] troubles with R CMD check and examples under Ubuntu gutsy
Patrick Giraudoux