Skip to content

Commit

Permalink
Remove dontrun in examples and restore graĥical parameters modified b…
Browse files Browse the repository at this point in the history
…y par

This is required fo new submission on CRAN. dontrun examples are either removed, transformed into donttest or tested for interactivity
  • Loading branch information
sdray committed Oct 4, 2023
1 parent d2e9fe4 commit 66f600f
Show file tree
Hide file tree
Showing 29 changed files with 95 additions and 69 deletions.
4 changes: 3 additions & 1 deletion R/LCBD.comp.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@
#' col = c("white", "brown"), main = "Doubs fish abundance diff. LCBD")
#' }
#'
#' \dontrun{
#' \donttest{
#' if(require("ade4", quietly = TRUE) & require("betapart", quietly = TRUE)){
#' ### Example 3
#' ### This example requires packages \code{"betapart"} and \code{"ade4"} for data.
#' ### For the Baselga-family indices, the same partitioning results are obtained using
Expand Down Expand Up @@ -131,6 +132,7 @@
#' out3.AbDiff$beta
#' # Compare BDtotal here to RichDiff/Nes in out.comp$part (above)
#' }
#' }
#'
#' @importFrom stats as.dist
#' @export LCBD.comp
Expand Down
4 changes: 2 additions & 2 deletions R/Tiahura.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
#' chron=TRUE)
#'
#' ## Plotting the results
#' par(mfrow=c(3,1))
#' oldpar <- par(mfrow=c(3,1))
#'
#' ## First graph: constrained clusters
#' par(mar=c(3,6.5,2,2))
Expand Down Expand Up @@ -176,6 +176,6 @@
#' ## plot_slice(3L,5L)
#' ## plot_slice(4L,5L)
#' ## plot_slice(5L,5L)
#'
#' par(oldpar)
NULL
##
3 changes: 2 additions & 1 deletion R/WRperiodogram.R
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
#' # Periodogram of the lunar component only
#' res.moon.250 <- WRperiodogram(moon, nperm=0) # T1=2, T2=n/2=250; no test
#' res.moon.130 <- WRperiodogram(moon, T2=130, nperm=499)
#' par(mfrow=c(1,2))
#' oldpar <- par(mfrow=c(1,2))
#' # Plot 2 moon cycles, n = 118*2 = 236 points
#' plot(moon[1:236], xlab="One time unit = 6 hours")
#' plot(res.moon.130, prog=1) # Plot the periodogram
Expand Down Expand Up @@ -207,6 +207,7 @@
#' # The yearly cycle and harmonics are significant
#' # Compare the results of afc() to those of WRperiodogram above
#' acf(ldeaths) # lag=1.0 is one year; see ?acf
#' par(oldpar)
#'
#' @useDynLib adespatial, .registration = TRUE
#' @importFrom graphics lines points
Expand Down
3 changes: 2 additions & 1 deletion R/aem.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
#' # Illustrate 4 AEM eigenfunctions using bubble plots
#' opal <- palette()
#' palette(c("black","white"))
#' par(mfrow=c(2,2))
#' oldpar <- par(mfrow=c(2,2))
#' symbols(x=xy[,2:3], circles=abs(res$vectors[,1]), inches=FALSE, asp=1,
#' fg=ifelse(sign(-res$vectors[,1])+1>0,1,0),
#' bg=ifelse(sign(res$vectors[,1])+1>0,1,0), xlab="x", ylab="y")
Expand Down Expand Up @@ -113,6 +113,7 @@
#' title("AEM 4")
#'
#' palette(opal)
#' par(oldpar)
#'
#' # Construct AEM eigenfunctions with a function of the distance
#' # as weights to put on the links
Expand Down
3 changes: 2 additions & 1 deletion R/aem.build.binary.R
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
xy.range.min<-xy.range[1,2]-((xy.range[2,2]-xy.range[1,2])/5)
xy.range.max<-xy.range[2,2]

par(mar=c(1,1,1,1))
oldpar <- par(mar=c(1,1,1,1))
plot(coords[, 2:3], pch = 20, asp = 1, cex = 0.5, axes = FALSE,
xlab = "", ylab = "", ylim=c(xy.range.min,xy.range.max))
segments(x0 = coords[link[, 1], 2], y0 = coords[link[,
Expand All @@ -181,6 +181,7 @@
points(site0[1],site0[2],pch=19,col="blue")
segments(x0=site0[1],y0=site0[2],x1=coords[low.y,2],y1=coords[low.y,3],col="blue")
par(mar=c(5,4,4,2))
par(oldpar)
}
n.low.y <- length(low.y)
link <- rbind(cbind(rep(0, n.low.y), low.y), as.matrix(link))
Expand Down
3 changes: 2 additions & 1 deletion R/aem.weight.edges.R
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ aem.weight.edges <-
xy.range.min<-xy.range[1,2]-((xy.range[2,2]-xy.range[1,2])/5)
xy.range.max<-xy.range[2,2]

par(mar=c(1,1,1,1))
oldpar <- par(mar=c(1,1,1,1))
plot(coords[, 2:3], pch = 20, asp = 1, cex = 0.5, axes = FALSE, xlab = "", ylab = "", ylim=c(xy.range.min,xy.range.max))
segments(x0 = coords[links[, 1], 2], y0 = coords[links[, 1], 3], x1 = coords[links[, 2], 2], y1 = coords[links[, 2], 3], col = "red")
text(coords[,2:3],labels=as.character(coords[,1]),pos=2,col="red")
Expand All @@ -205,6 +205,7 @@ aem.weight.edges <-
points(site0[1],site0[2],pch=19,col="blue")
segments(x0=site0[1],y0=site0[2],x1=coords[low.y,2],y1=coords[low.y,3],col="blue")
par(mar=c(5,4,4,2))
par(oldpar)
}

### Reorganize the edges
Expand Down
4 changes: 2 additions & 2 deletions R/chooseCN.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@
#' if(require("ade4", quietly = TRUE)){
#' data(mafragh)
#'
#' par(mfrow=c(2,2))
#' oldpar <- par(mfrow=c(2,2))
#' cn1 <- chooseCN(mafragh$xy,ask=FALSE,type=1)
#' cn2 <- chooseCN(mafragh$xy,ask=FALSE,type=2)
#' cn3 <- chooseCN(mafragh$xy,ask=FALSE,type=3)
#' cn4 <- chooseCN(mafragh$xy,ask=FALSE,type=4)
#'
#' par(oldpar)
#' }
#'
#' @export chooseCN
Expand Down
24 changes: 13 additions & 11 deletions R/constr.hclust.R
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@
#' ## A fonction to plot the Whiskey clustering results:
#'
#' plotWhiskey <- function(wh, k) {
#' par(fig=c(0,1,0,1))
#' oldpar <- par(fig=c(0,1,0,1))
#' plot(grpWD2cst_ScotchWhiskey[[wh]], k=k, links=TRUE, las=1,
#' xlab="Eastings (km)", ylab="Northings (km)", cex=0.1, lwd=3,
#' main=sprintf("Feature: %s",wh))
Expand All @@ -294,6 +294,7 @@
#' text(ScotchWhiskey$geo@coords/1000,labels=1:length(ScotchWhiskey$geo))
#' rect(xleft=SpeyZoom$xlim[1L], ybottom=SpeyZoom$ylim[1L],
#' xright=SpeyZoom$xlim[2L], ytop=SpeyZoom$ylim[2L], lwd=2, lty=1L)
#' par(oldpar)
#' }
#'
#' ## Plot the clustering results on the map of Scotland for 5 groups.
Expand All @@ -306,14 +307,13 @@
#'
#' ## End of the Scotch Whiskey tasting data example
#'
#' \dontrun{
#' \donttest{
#'
#' ## Third example: Fish community composition along the Doubs River,
#' ## France. The sequence is analyzed as a case of chronological
#' ## clustering, substituting space for time.
#'
#' library(ade4)
#' library(adespatial)
#' if(require("ade4", quietly = TRUE)){
#' data(doubs, package="ade4")
#' Doubs.D <- dist.ldc(doubs$fish, method="hellinger")
#' grpWD2cst_fish <- constr.hclust(Doubs.D, method="ward.D2", chron=TRUE,
Expand Down Expand Up @@ -349,12 +349,13 @@
#' coords=ex.xy # File of geographic coordinates
#' )
#'
#' par(mfrow=c(1,2))
#' oldpar <- par(mfrow=c(1,2))
#' ## Plot the map of the results for k = 3
#' plot(test.out, k=3)
#' ## Plot the dendrogram
#' stats:::plot.hclust(test.out, hang=-1)
#'
#' par(oldpar)
#' }
#'
#' ## Same example modified: disjoint clusters
#' ## Same ex.Y and ex.xy as in the previous example
Expand All @@ -381,12 +382,13 @@
#' )
#' cutree(test.out2, k=2)
#'
#' par(mfrow=c(1,2))
#' oldpar <- par(mfrow=c(1,2))
#' ## Plot the map of the results for k = 3
#' plot(test.out2, k=3)
#' ## Plot the dendrogram showing the disconnected groups
#' stats:::plot.hclust(test.out2, hang=-1)
#' axis(2,at=0:ceiling(max(test.out2$height,na.rm=TRUE)))
#' par(oldpar)
#'
#' ## End of the disjoint clusters example
#'
Expand All @@ -396,8 +398,7 @@
#' ## Computing time grows with N at roughly the same speed as the memory
#' ## storage requirements to store the dissimilarity matrices.
#'
#' require(magrittr)
#' require(pryr)
#' if(require("magrittr", quietly = TRUE) & require("pryr", quietly = TRUE)){
#'
#' benchmark <- function(nobj) {
#' # Argument -
Expand Down Expand Up @@ -436,7 +437,7 @@
#'
#' ## Plotting the results:
#' ok <- res %>% apply(1L, function(x) !x %>% is.na %>% any)
#' par(mar=c(3,6,2,2),mfrow=c(2L,1L))
#' oldpar <- par(mar=c(3,6,2,2),mfrow=c(2L,1L))
#' barplot(height = res[ok,"Time (sec)"], names.arg= res[ok,"N.objects"],
#' ylab="Time (seconds)\n",xlab="",las=1L,log="y")
#' par(mar=c(5,6,0,2))
Expand All @@ -446,9 +447,10 @@
#'
#' ## Examine the output file
#' res
#'
#' par(oldpar)
#' ## End of the benchmarking example
#' }
#' }
#' ## End of examples
#'
#' @useDynLib adespatial, .registration = TRUE
Expand Down
2 changes: 1 addition & 1 deletion R/envspace.test.R
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
#' @keywords spatial
#'
#' @examples
#' \dontrun{
#' \donttest{
#' if(require(vegan)) {
#' # Illustration of the test of the SSEF on the oribatid mite data
#' # (Borcard et al. 1992, 1994 for details on the dataset):
Expand Down
2 changes: 1 addition & 1 deletion R/listw.explore.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#' @seealso \code{\link{chooseCN}}
#' @returns No return value
#' @examples
#' \dontrun{
#' if(interactive()){
#' ## a matrix or an object of class 'Spatial*' should be in the global environment
#' xy <- matrix(rnorm(50), 25)
#' listw.explore()
Expand Down
2 changes: 1 addition & 1 deletion R/listw.select.R
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
#'@keywords spatial
#'
#' @examples
#' \dontrun{
#' \donttest{
#' if(require(spdep)) {
#' ### Create a grid of 15 x 15:
#' grid <- expand.grid(x = seq(1, 15, 1), y = seq(1, 15, 1))
Expand Down
15 changes: 8 additions & 7 deletions R/multispati.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
#' labels <- lapply(1:length(obj$eig),function(i) bquote(lambda[.(i)]))
#' # draw the plot
#' xmax <- eval(as.list(obj$call)$dudi)$eig[1]*1.1
#' par(las=1)
#' oldpar <- par(las=1)
#' var <- sum.obj[,2]
#' moran <- sum.obj[,3]
#' plot(x=var,y=moran,type='n',xlab='Inertia',ylab="Spatial autocorrelation (I)",
Expand All @@ -123,6 +123,7 @@
#' segments(0,I0,xmax,I0,lty=2)
#' abline(v=0)
#' title("Spatial and inertia components of the eigenvalues")
#' par(oldpar)
#' }
#' fgraph(maf.coa.ms)
#' ## end eigenvalues details
Expand All @@ -134,11 +135,11 @@
#' g4 <- s.corcircle(maf.coa.ms$as, plot = FALSE)
#' G1 <- ADEgS(list(g2, g3, g4), layout = c(1, 3))
#' } else {
#' par(mfrow = c(1, 3))
#' oldpar <- par(mfrow = c(1, 3))
#' barplot(maf.coa$eig)
#' barplot(maf.coa.ms$eig)
#' s.corcircle(maf.coa.ms$as)
#' par(mfrow = c(1, 1))
#' par(oldpar)
#' }
#'
#'
Expand All @@ -149,12 +150,12 @@
#' g8 <- s.value(maf.xy, maf.coa.ms$li[, 2], plot = FALSE)
#' G2 <- ADEgS(list(g5, g6, g7, g8), layout = c(2, 2))
#' } else {
#' par(mfrow = c(2, 2))
#' oldpar <- par(mfrow = c(2, 2))
#' s.value(maf.xy, -maf.coa$li[, 1])
#' s.value(maf.xy, -maf.coa$li[, 2])
#' s.value(maf.xy, maf.coa.ms$li[, 1])
#' s.value(maf.xy, maf.coa.ms$li[, 2])
#' par(mfrow = c(1, 1))
#' par(oldpar)
#' }
#'
#'
Expand All @@ -167,10 +168,10 @@
#' g10 <- s.match(w1.ms, w1.msm, plab.cex = 0.75, plot = FALSE)
#' G3 <- cbindADEg(g9, g10, plot = TRUE)
#' } else {
#' par(mfrow = c(1,2))
#' oldpar <- par(mfrow = c(1,2))
#' s.match(w1, w1m, clab = 0.75)
#' s.match(w1.ms, w1.msm, clab = 0.75)
#' par(mfrow = c(1, 1))
#' par(oldpar)
#' }
#'
#' maf.pca <- dudi.pca(mafragh$env, scannf = FALSE)
Expand Down
8 changes: 4 additions & 4 deletions R/plot.TBI.R
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
#'
#' ## Draw BC plots
#'
#' par(mfrow=c(1,2))
#' oldpar <- par(mfrow=c(1,2))
#'
#' s.names <- paste("Surv",1:12,sep=".")
#'
Expand All @@ -125,7 +125,7 @@
#'
#' ## In the 3rd plot, draw all symbols small and of the same size, using cex.symb=NULL
#'
#' dev.off()
#' par(oldpar)
#'
#' plot(res1, s.names=1:12, col.bg="gold", pch.loss=23, pch.gain=24,
#' main="B-C plot, Pyrifos, surveys 4 & 11", cex.symb=NULL)
Expand All @@ -145,7 +145,7 @@
#'
#' ## Draw BC plots
#'
#' par(mfrow=c(1,2))
#' oldpar <- par(mfrow=c(1,2))
#'
#' s.names=rownames(res2$BCD.mat)
#'
Expand All @@ -158,7 +158,7 @@
#'
#' plot(res2, s.names=1:20, col.rim="coral2", pch.loss=19, pch.gain=15,
#' main="B-C plot, Mite data", xlim=c(0,0.6), ylim=c(0,0.6))
#'
#' par(oldpar)
#' }
#'
#' @importFrom graphics abline
Expand Down
2 changes: 1 addition & 1 deletion R/stimodels.R
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
#' # of the times shows a significant spatial structure can be done with model 6a. For a
#' # global test of temporal structure at the various sites, use model 6b.
#'
#' \dontrun{ # Code not run during CRAN software tests
#' \donttest{ # Code not run during CRAN software tests
#'
#' # Example 2. Run space-time analysis with global tests for main effects after testing
#' # the interaction, which is significant in this example
Expand Down
4 changes: 3 additions & 1 deletion man/LCBD.comp.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/Tiahura.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/WRperiodogram.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 66f600f

Please sign in to comment.