Learn R Programming

swfscMisc

Description

swfscMisc is a collection of utility functions used at the NOAA Southwest Fisheries Science Center in La Jolla, CA. The package contains functions for geodesic calculations, commonly used mapping functions, plotting special symbols, and miscellaneous analytical and conversion functions.

Installation

To install the stable version from CRAN:

install.packages('swfscMisc')

To install the latest version from GitHub:

# make sure you have devtools installed
if (!require('devtools')) install.packages('devtools')
# install from GitHub
devtools::install_github('ericarcher/swfscMisc')

Contact

Current functions

  • Geodesic functions:

    • bearing
    • datum
    • distance
    • circle.polygon
    • convert.angle
    • convert.distance
  • Plotting functions:

    • braces
    • catSpatInterp Categorical Spatial Interpolation
    • color.name
    • lab.wid
    • lat.lon.axes
    • row.col.page.fit
    • ggBiplot
    • scatterdens
    • scatterhist
    • sex.symbols
  • Distribution functions:

    • betaParams
    • central.quantile
    • distSmry
    • fisher.p
    • gammaParams
    • pVal
    • sn.params
    • uniform.test
  • Miscellaneous functions:

    • affin.prop
    • autoUnits
    • box.area
    • central.quantile
    • copy.tri
    • crossing.point
    • geometric.mean
    • harmonic.mean
    • isBetween
    • month2Season
    • mcmc2list
    • na.count
    • odds conversion (odds, invOdds, logOdds, invLogOdds)
    • one.arg
    • plotAssignments
    • ceiling, floor, trunc, round (.data.frame)
    • runjags2list
    • stan2list
    • setupClusters
    • which.nearest
    • zero.pad

Changelog

version 1.7.6 (devel)

  • changed usage of ggplot2::aes_string() to ggplot2::aes()
  • updated ggBiplot to work with prcomp() output as well as princomp()
  • changed use of modeest::mlv() to stats::density() in distSmry() because modeest is getting archived on CRAN

version 1.7 (on CRAN)

version 1.6.6

  • fixed bug in runjags2list() if variable in monitor vector wasn't in model
  • added betaParams() and gammaParams()
  • removed diversity() - now in sprex package

version 1.6.5

  • removed sample.map()
  • added imdo()
  • added intersectingPoint()
  • added ability to use modeest::mlv() to estimate mode in distSmry()
  • fixed pVal() to handle NA and NaN values correctly
  • deprecating diversity(). New function in sprex package.
  • added runjags2list() to format posterior samples from runjags::run.jags().
  • corrected package name alias documentation for CRAN

version 1.6

  • reset setupClusters to choose correct function for OS
  • added perpDist() and perpPt()
  • added distSmry()
  • added sn.params functions for computing skew normal parameters and moments

version 1.5

  • removed das.* functions

version 1.4

  • added catSpatInterp for Categorical Spatial Interpolation (based on code by Timo Grossenbacher)
  • begin deprecation of das.* functions. to be removed in v1.5.
  • change destination() to accept vectors and return a matrix.
  • fixed plotAssignments() to not change class names.
  • updated spatstat import

version 1.3

  • fixed plotAssignments to use facets and removed grids and space around panels
  • added setupClusters

version 1.2

  • Added rounding functions for data.frames.
  • Removed NEWS.md - changelog moved to README.md
  • Added plotAssignments function.

version 1.1

  • Added autoUnits function
  • Changed default arguments for lat.range and lon.range to NULL in sample.map. If not specified, the ranges will be set to the ranges of the lat and lon.

version 1.0.9

  • Added transparent function
  • Changed distance and destination functions to accept partial matches for method

of calculation, type of surface, and units

version 1.0.8

  • Fixed das.read to handle errors in position and suppress warnings about NAs

during numerical conversions.

  • Fixed das.map to remove records with no position

version 1.0.7

  • Changed isBetween to accept a vector of numbers

version 1.0.6

  • Added NEWS.md
  • Added diversity function (moved from strataG package)
  • Added isBetween function to test if a number is between two numbers

Copy Link

Version

Install

install.packages('swfscMisc')

Monthly Downloads

1,544

Version

1.7.6

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Eric Archer

Last Published

September 25th, 2026

Functions in swfscMisc (1.7.6)

intersectingPoint

Intersecting Point
crossing.point

Crossing Point
lat.lon.axes

Latitude and Longitude axes
swfscMisc

swfscMisc package
transparent

Transparent Colors
lab.wid

Label Width
odds

Odds Conversion
uniform.test

Uniform Distribution Test
weighted.fisher.p

Weighted Fisher's Method p-value
ggBiplot

ggBiplot
na.count

Count NAs
geometric.mean

Geometric Mean
runjags2list

Convert runjags posterior to list
stan2list

Convert STAN posterior to list
row.col.page.fit

Number of Rows and Columns on Page
isBetween

Between
pVal

Permutation Test P-value
one.arg

One Argument
month2Season

Convert Months to Seasons
harmonic.mean

Harmonic Mean
mcmc2list

Convert mcmc.list posterior to list
plotAssignments

Plot assignment distributions
scatterdens

Scatter Plot with Density Margins
perpPoint

Perpendicular Point
perpDist

Perpendicular Distance
imdo

Iterative Missing Data Optimization (IMDO)
round

Rounding Numbers for Data Frames
setupClusters

Setup Clusters
stouffer.p

Stouffer's Method p-value
sex.symbols

Sex Symbols
sn.params

Skew-Normal parameter computation
zero.pad

Zero Pad Integers
which.nearest

Which Nearest
color.name

Color Name
braces

Braces
affin.prop

Affinity Propagation
central.quantile

Central Quantile
betaParams

Calculate Beta parameters
autoUnits

Auto Time Interval Units
bearing

Calculate Bearing Between Two Positions
box.area

Area of a Box
catSpatInterp

Categorical Spatial Interpolation
circle.polygon

Circle Polygon (on Earth)
convert.distance

Distance Conversion
convert.angle

Angle Conversion
copy.tri

Copy Matrix Triangles
distance

Distance Between Coordinates
gammaParams

Calculate Gamma parameters
destination

Destination on Sphere or Ellipsoid
datum

Datum
distSmry

Distribution summary
fisher.p

Fisher's Method p-value