-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
63 lines (47 loc) · 2.15 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# circhelp
<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/circhelp)](https://CRAN.R-project.org/package=circhelp)
<!-- badges: end -->
`circhelp` is a small helper package for circular data analyses in R, particularly useful for cognitive studies on orientation, motion direction, and other circular features. The package contains functions for descriptive statistics of circular data (computing means, SD, and skewness), angular differences, and correlation. It also includes a function to correct for cardinal biases in human estimates of circular features (e.g., orientation). The documentation is available in the package help files and at https://achetverikov.github.io/circhelp/.
## Installation
You can install the latest released version from CRAN with:
``` r
install.packages("circhelp")
```
The current developmental version from [GitHub](https://github.com/) can be installed with:
``` r
# install.packages("devtools")
devtools::install_github("achetverikov/circhelp")
```
## Usage
Most functions are self-explanatory.
```{r}
library(circhelp)
library(mgcv)
# compute a set of descriptive statistics
x <- rnorm(500)
circ_descr(x)
# compute difference in orientations
a <- 5
b <- 170
angle_diff_180(a, b)
# compute difference in 360° space (e.g., motion directions)
angle_diff_360(a, b)
# compute correlation between angles
data <- rmvn(10000, c(0, 0), V = matrix(c(1, 0.5, 0.5, 1), ncol = 2))
circ_corr(data[, 1], data[, 2])
```
The only (somewhat) complicated function is `remove_cardinal_biases`, see the [help files](https://achetverikov.github.io/circhelp/reference/remove_cardinal_biases.html) and [the vignette](https://achetverikov.github.io/circhelp/articles/cardinal_biases.html) for an example use case.
<img src="https://achetverikov.github.io/circhelp/articles/cardinal_biases_files/figure-html/correct_biases_ex-1.png" title="Example of cardinal biases processing" width="100%"/>