The Package Ecosystem

So Much Stuff...

So Much Stuff...

How do you find a new package?

How do you approach a new package?

  • Install it
  • Has it got any vignettes?
  • Has it got any examples?

Example: the SSN package


ssmrob	Robust estimation and inference in sample selection models
SSN	Spatial Modeling on Stream Networks
sspir	State Space Models in R


> install.packages("SSN")

More and more packages are coming from other archives now - look out for things on github and R-forge.


Should be nice introductions to the package

> vignette(package="SSN")
Vignettes in package ‘SSN’:

SSN                     Model Introduction and SSN User Manual (source,
STARS                   GIS Information and STARS User manual (source,
> vignette("SSN")


Help files can contain example code. You can run this with the example function.

> require(SSN)
> example(glmssn)

Can cover things like reading, creating and plotting custom data classes...

> require(SSN)
> data(mf04p)
> class(mf04p)
[1] "SpatialStreamNetwork"
[1] "SSN"
> mf04p@path <- system.file("lsndata/MiddleFork04.ssn", 
     package = "SSN")
> plot(mf04p, "Summer_mn", asp = 1)
plot of chunk unnamed-chunk-1

And fitting and plotting spatial models

> mf04.glmssn0 <- glmssn(Summer_mn ~ 
     ELEV_DEM + SLOPE, mf04p, CorModels = NULL)
> summary(mf04.glmssn0)
  FactorLevel  Estimate   std.err t.value  prob.t
1 (Intercept)  62.83937 10.654189   5.898 0.00000
2    ELEV_DEM  -0.02496  0.005379  -4.639 0.00003
3       SLOPE -88.01999 31.991341  -2.751 0.00872

  Covariance.Model Parameter Estimate
1           Nugget   parsill    1.807

> plot(residuals(mf04.glmssn0), asp = 1)
plot of chunk unnamed-chunk-2

Every Package Is Different

  • functionName,, function_name, FunctionName...
  • lots of help vs no help
  • vignettes/no vignettes
  • examples/no examples

But hopefully things are getting better!