Learn R Programming

tectonicr

tectonicr is a free and open-source R package for modeling and analyzing the direction of the maximum horizontal stress (SHmax) based on the empirical link between the direction of intraplate stress and the direction of the relative motion of neighboring plates (Wdowinski, 1998; Stephan et al., 2023). The following methods are available:

  • Direction of the plate boundary forces: PoR_shmax() gives the predicted stress field adjacent to a plate boundary, calculated using the relative plate motion of the neighboring plates using the function model_shmax(). The goodness-of-fit can be statistically tested by e.g.circular_dispersion(),rayleigh_test(), and confidence_interval().
  • Distance to plate boundary: distance_from_pb() gives the distance between the stress data point and the plate boundary measured along the stress trajectories.
  • Trajectories of the theoretical stress field eulerpole_paths() generates an sf object containing spatial information that is suitable to plot with, for instance, ggplot().
  • Azimuth plotting using geom_azimuth() or geom_azimuthpoint() in ggplot.
  • Relative rotations from a given set of plate motion parameters: equivalent_rotation() transfers a set of plate motion parameters into the relative plate motions among the given plates.
  • Average direction and variance of a set of SHmax data using (weighted) statistics and other parameters to statistically estimate the distribution parameters of pi-directional data.
  • Spatial interpolation of of SHmax: PoR_stress2grid() uses distance, method, and quality-weighted mean direction of stress data without being affected by angular distortions.
  • Rose plot rose() shows the frequencies of the orientations in polar coordinates
  • Stress anomaly map: spatial distribution of the dispersion of the observed stress field from the directions of plate boundary forces with kernel_dispersion()
  • Download and filter world stress map data using download_WSM()

The {tectonicr} package is all about orientation data in 2D. For analyzing orientations in 3D (spherical statistics, equal-area projections, etc. ), check out the structr package!

Prerequisites

You must have R installed on your system (see https://www.r-project.org/). To install tectonicr from CRAN, type the following code at the R command line prompt:

install.packages("tectonicr")

Installation

The most recent development version of tectonicr is available from Github and can be installed on your system as follows:

# install.packages("remotes") # install if needed
remotes::install_github('tobiste/tectonicr')
library('tectonicr')

Using the stress measurements from the San Andreas Fault - Gulf of California example, a quick analysis and test against the right-lateral transform plate boundary can be achieved by:

# load example data
data(san_andreas)
data(nuvel1)
data(plates)

stress_analysis(
san_andreas, 
PoR = equivalent_rotation(nuvel1, "na", "pa"), 
type = "right", 
pb = subset(plates, pair == "na-pa")
)

The code produces the underlying results for Fig. 7 from Stephan et al. (2023)

Documentation

The detailed documentation can be found at https://tobiste.github.io/tectonicr/articles/A_tectonicr.html

GUI

There is a graphical user interface that provides some (limited) tectonicr functionalities. No need to install, just click on the link and you can run tectonicr on your browser:

https://tobiste.shinyapps.io/tectonicr-app/

Author

Tobias Stephan (tstephan@lakeheadu.ca)

Feedback, issues, and contributions

I welcome feedback, suggestions, issues, and contributions! If you have found a bug, please file it here with minimal code to reproduce the issue.

How to cite tectonicr

When referencing this package, please cite

Stephan, T., Enkelmann, E., and Kroner, U. (2023). Analyzing the horizontal orientation of the crustal stress adjacent to plate boundaries. Scientific Reports, 13(1). DOI: 10.1038/s41598-023-42433-2.

and the package DOI: 10.32614/CRAN.package.tectonicr.

License

GPL-3.0 License

Copy Link

Version

Install

install.packages('tectonicr')

Monthly Downloads

517

Version

0.4.8

License

GPL (>= 3)

Maintainer

Tobias Stephan

Last Published

December 12th, 2025

Functions in tectonicr (0.4.8)

compact-grid

Compact Smoothed Stress Field
confidence

Confidence Interval around the Mean Direction of Circular Data after Batschelet (1971)
earth_radius

Earth's radius in km
circular_sd_error

Standard Error of Mean Direction of Circular Data
dummy

Plate Stress Dummy Grid
circular_summary

Circular Summary Statistics
distance_binned_stats

Distance Binned Summary Statistics
coordinates2

Coordinate Transformations
distance_from_pb

Distance from plate boundary
dist_greatcircle

Distance between points
distance_mod

Normalize angular distance on a sphere distance
cpm_models

Global model of current plate motions
dispersion

Circular Distance and Dispersion
deviation_shmax

Deviation of Observed and Predicted Directions of Maximum Horizontal Stress
confidence_interval_fisher

Confidence Interval around the Mean Direction of Circular Data after Fisher (1993)
coordinate_mod

Coordinate Correction
angle_vectors

Angle Between Two Vectors
coordinates

Coordinate Transformations
conjugate_Q4

Conjugation of a Quaternion
data2PoR

Transforms coordinates and azimuths into PoR coordinates system
deviation_norm

Normalize Angle Between Two Directions
equivalent_rotation

Equivalent rotation
euler_pole

Euler pole object
estimate-kappa

Concentration parameter of von Mises distribution
geom_azimuthpoint

Azimuth + point visualization
get_distance

Helper function to Distance from plate boundary
geom_azimuth

Azimuth visualization
kernel_dispersion

Adaptive Kernel Dispersion
norm_chisq

Normalized Chi-Squared Test for Circular Data
get_projected_pb_strike

Helper function to get Distance from plate boundary
is.Q4

Check if object is quaternion
get_azimuth

Azimuth Between two Points
kuiper_test

Kuiper Test of Circular Uniformity
mean_resultant_length

Mean Resultant Length
model_shmax

Theoretical Direction of Maximum Horizontal Stress in the geographical reference system.
ort-eigen

Decomposition of Orientation Tensor in 2D
ortensor2d

Orientation Tensor
nuvel1

NUVEL-1 Global model of current plate motions
nuvel1_plates

Plate Boundaries on the Earth
parse_wsm

Numerical values to World Stress Map Quality Ranking
line_azimuth

Extract azimuths of line segments
pb2002

Global model of current plate motions
mean_SC

Mean Cosine and Sine
import_WSM

World Stress Map Database (WSM)
get_relrot

Helper function to Equivalent rotation
projected_pb_strike

Strike of the plate boundary projected on data point
product_Q4

Product of quaternions
por_transformation_df

Conversion between spherical PoR to geographical coordinate system of data.frames
rose_stats

Show Average Direction and Spread in Rose Diagram
prd_err

Error of Model's Prediction
por_transformation_quat

Conversion between PoR to geographical coordinate system using quaternions
is.euler

Check if object is euler.pole
plot_density

Circular Density Plot
rose_geom

Direction Lines and Fans in Circular Diagram
sample_dispersion

Sample circular dispersion
rose_bw

Selecting optimal number of bins and width for rose diagrams
rotation_Q4

Rotation of a vector by a quaternion
plates

Plate Boundaries on the Earth
por_transformation_sf

Conversion between PoR to geographical coordinates of sf data
plot_points

Add Points to a Circular Plot
spec_atan

Quadrant-specific inverse of the tangent
shortest_distance_to_line

Shortest distance between pairs of geometries
quick_plot

Plotting Stress Analysis Results
por_transformation

Conversion between spherical PoR to geographical coordinate system
raster_transformation

Conversion between PoR to geographical coordinate reference system of raster data
normalize_Q4

Quaternion normalization
rose

Rose Diagram
roll_circstats

Apply Rolling Functions using Circular Statistics
rayleigh_test

Rayleigh Test of Circular Uniformity
relative_rotation

Relative rotation between two rotations
spherical_angle

Angle along great circle on spherical surface
rolling_test_dist

Apply Rolling Functions using Circular Statistics
tectonicr

library(tectonicr)
tectonicr.colors

Colors for input variables
sample_median

Sample Circular Median and Deviation
rotate_lines

Rotate Lines
stress_colors

Color palette for stress regime
rolling_test

Apply Rolling Functions using Circular Statistical Tests for Uniformity
stress_analysis

Quick analysis of a stress data set
second_central_moment

Second Central Momentum
trigon

Trigonometric Functions in Degrees
vcross

Vector cross product
vonmises

The von Mises Distribution
vm_qqplot

von Mises Quantile-Quantile Plot
weighted_rayleigh

Weighted Goodness-of-fit Test for Circular Data
weighting

Weighting Factors
watson_test

Watson's \(U^2\) Test of Circular Uniformity
which.nsmallest

Indices of n smallest values in array
stress_paths

Theoretical Plate Tectonic Stress Paths
stress_data

Example crustal stress dataset
superimposed_shmax_PB

SHmax direction resulting from multiple plate boundaries considering distance to plate boundaries
superimposed_shmax

SHmax direction resulting from multiple plate boundaries
stress2grid

Spatial Interpolation of SHmax
PoR2Geo_azimuth

Azimuth Conversion From PoR to Geographical Coordinate Reference System
Q4_to_euler

Euler angle/axis from quaternion
PoR_azi

Azimuth Conversion from Geographical to PoR Coordinate Reference System
PoR_crs

PoR coordinate reference system
abs_vel

Absolute Plate Velocity
PoR_distance

Distance to Pole of Rotation
PoR_stress2grid

Spatial Interpolation of SHmax in PoR Coordinate Reference System
PoR_map

Map of data in Pole of Rotation reference frame
PoR_coordinates

Coordinates of the Pole of Rotation Reference System
circular_qqplot

Quantile-Quantile Linearised Plot for Circular Distributions
circular_mode

Circular Mode
PositionCenterSpoke

Centrically aligned geom_spoke marker
axes

Plot axes
circular_range

Circular Range
circle_mean_diff

Circular Mean Difference
angle-conversion

Degrees to Radians
circular_plot

Circular plot
circle_stats

Summary Statistics of Circular Data
circular_dispersion_boot

Bootstrapped Estimates for Circular Dispersion