-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.Rmd
93 lines (71 loc) · 2.5 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
---
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%"
)
```
# ggethos <a href="https://matiasandina.github.io/ggethos/"><img src="man/figures/logo.png" align="right" height="138" /></a>
<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/ggethos)](https://CRAN.R-project.org/package=ggethos)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
<!-- badges: end -->
The goal of `ggethos` is to provide a user-frienldy way to plot ethograms using `ggplot2`.
## Installation
At this point, this is an experimental package, and you can only install the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("matiasandina/ggethos")
```
Once it's on CRAN, you can install the released version of ggethos from [CRAN](https://CRAN.R-project.org) with:
``` r
install.packages("ggethos")
```
And the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("matiasandina/ggethos")
```
## Example
This is a basic example of plotting ethograms with `ggethos`:
```{r example, message=F, warning=F}
library(ggplot2)
library(ggethos)
library(dplyr)
wombats %>%
group_by(wombat) %>%
slice(1:2)
```
Let's plot the behavior of the wombats
```{r}
# x axis will be in sample space
ggplot(wombats, aes(y=wombat, behaviour=behaviour)) + geom_ethogram()
```
Let's look at them using a proper x axis and separating by trials:
```{r, warning=FALSE, message=F}
# x axis will be in seconds
ggplot(wombats, aes(x=seconds,
y=wombat,
behaviour=behaviour,
color=behaviour)) +
geom_ethogram() +
facet_wrap(~trial)
```
Can we align the trials? Yes! Use `align_trials = TRUE`:
```{r, warning=FALSE, message=F}
# x axis will be in seconds
# trials re-aligned
ggplot(wombats, aes(x=seconds,
y=wombat,
behaviour=behaviour,
color=behaviour)) +
geom_ethogram(align_trials = T) +
facet_wrap(~trial)
```
## Issues
This is a preliminary release and the package is still very much experimental. Please [file issues](https://github.com/matiasandina/ggethos/issues) to improve it.