﻿ Santiago Barreda
 Santiago Barreda Assistant Professor, Department of Linguistics, UC Davis
Main Research Vignettes CV phonTools Statistics Links

## rotate [phonTools]

This function may be used to rotate 2-dimensional variables (se series of x-y points) or complex-valued variables. Angle of rotation may be specified in radians or degrees. This functions supports two types of rotation, demonstrated on the blue dots in the figures below: rotation about the origin (left), and rotation 'in place', about the sample mean (right).

Code used to generate examples:

```
## rotate points in a 2D space
spots = cbind(seq (0,50,5), seq (0,50,5))
spotsRotated1 = rotate (spots, pi/2)
spotsRotated2 = rotate (spots, pi/2, origin = FALSE)

par (mfrow = c(1,2), mar = c(4,4,1,1))

plot (spots, pch = 16, col = 4, xlim = c(-50,50), ylim = c(-50,50),cex=2)
points (spotsRotated1, pch = 16, col = 2,cex=2)
abline (h=0, v=0, lty='dotted')

plot (spots, pch = 16, col = 4, xlim = c(-50,50), ylim = c(-50,50),cex=2)
points (spotsRotated2, pch = 16, col = 2,cex=2)
abline (h=0, v=0, lty='dotted')

```