bor

bor: An R Package for Transforming Behavioral Observation Records into Data Matrices - Published in JOSS (2018)

https://github.com/davidnsousa/bor

Science Score: 93.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 4 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org, zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Scientific Fields

Engineering Computer Science - 40% confidence
Last synced: 6 months ago · JSON representation

Repository

Data analysis for field behavior observations of dyadic social interactions

Basic Info
  • Host: GitHub
  • Owner: davidnsousa
  • License: lgpl-3.0
  • Language: R
  • Default Branch: master
  • Size: 45.9 KB
Statistics
  • Stars: 0
  • Watchers: 2
  • Forks: 1
  • Open Issues: 0
  • Releases: 1
Created over 7 years ago · Last pushed almost 5 years ago
Metadata Files
Readme Changelog License

README.Rmd

---
output:
  md_document:
    variant: markdown_github
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(bor)
```

[![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/bor)](https://cran.r-project.org/package=bor)
[![Rdoc](http://www.rdocumentation.org/badges/version/bor)](http://www.rdocumentation.org/packages/bor)
[![Build Status](https://travis-ci.org/davidnsousa/bor.svg?branch=master)](https://travis-ci.org/davidnsousa/bor) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1317543.svg)](https://doi.org/10.5281/zenodo.1317543)
[![status](http://joss.theoj.org/papers/03ad4d832eb94173552f31d8a25dceb4/status.svg)](http://joss.theoj.org/papers/03ad4d832eb94173552f31d8a25dceb4)

# bor

## Overview

`bor`  is an `R` package designed to transform focal observations' data, referring to the occurrence of social interaction events, into asymmetric data matrices. For example, the number of times (events) a chimpanzee observes other group members. Each matrix cell provides counts on the number of times a specific type of social interaction was initiated by the row subject and directed to the column subject.

Currently, the package includes three objects:

* `dtable()` a function that transforms raw focal observations' data into a data frame
more suitable for data analysis

* `countb()` a function that computes asymmetric data matrices, separately for each observer and type of social interaction, from a data frame with a structure similar to that of the output of `dtable()` function

* `ex_field_data` a data frame containing an example of raw focal observations' data; data frames passed to `dtable()` function should have this structure.

For more information about this package the user can read the R documentation for `bor` (click the "rdocumentation" badge at the top of the README file). To learn more details about each `bor` object the user can type `?dtable`, `?countb` and `?ex_field_data` in his R environment.

## Installation

```{r, eval = F}
# to install R packages from github you need the devtools package
# to install devtools from CRAN type:
install.packages("devtools")

# to install bor from github type:
devtools::install_github("davidnsousa/bor")
```

## Details

`ex_field_data` details the required structure of raw focal observations' data that can be passed to the `dtable()` function.
Below we present the first lines of this data frame:

``` {r, eval = T, echo = T}
head(ex_field_data)
```

* `id1` - focal subject's identification code.
  + This example includes 9 different subjects (coded **s1** to **s9**).

* `act` - recorded social interactions (SIs) in each focal sample.
  + In this example two different SIs were recorded (coded **+** and **-**); SIs codes, subjects' id codes, and separation characters should not overlap.
  + The **.** character is used to separate subjects' id codes from the SIs' codes, and the **;** character is used to separate different SIs occurring within the same focal sample.
  + Whenever a subject's id appears before a SI's code it means that, that subject initiated a SI with the focal subject (see row 6 of `ex_field_data`); whenever a subject's id appears after the SI's it means that the focal subject (id1 column) initiated a SI with that subject (see row 4).
  + For example, in `ex_field_data`, the 4th row indicates that the focal subject **s1** initiated a **+** social interaction with subject **s4**, while the 6th row indicates that the focal subject **s5** was involved in two social interactions- the first initiated by **s4** (**-**), the second (**+**) initiated by **s2**.
  + **0**s in this column refer to focal observations where no SIs were recorded, and **x**s refer to focal observations where the focal subject was unavailable for observation.

* `obs` - observer's identification code.
  + This example includes 2 different observers (coded **1** and **2**).

See `?ex_field_data` for further details.
`dtable()` function does not require that the input data frame has matching column names to that of `ex_field_data`, but input data frame should include three columns, with the type of data as described above and in the same column order.


## Example

The following uses `dtable()` function to convert `ex_field_data` data frame (see details above) in a new data frame (e.g., **data**) that can be passed to `countb()` function.
`dtable()` function requires that recorded social interactions' codes are provided (**bset** argument). In `ex_field_data` these codes are **+** and **-**.
Below we leave **bsep**, **asep**, **missing** and **noc**  `dtable()`'s arguments at their default values (".", ";", "x", "0" respectively). See `?dtable` for further details.

``` {r}
 b <- c("+","-")
 data <- dtable(ex_field_data, bset = b)
 head(data)
```

`data` object has 7 columns: 

* `id1`- focal subject's identification code.

* `id2`- identification code of the social interactions partner.

* `sender_id1` - indicates whether the focal subject was the initiator/sender (coded 1) or the target of the social interaction (coded 0).

* `behavior` - indicates the code of the social interaction recorded.

* `no_occurrence` - indicates whether no social interaction were recorded (coded 1; NA otherwise).

* `missing` - indicates whether the focal subject was unavailable for observation (coded 1; NA otherwise).

* `observer` - observer's identification code.

`countb()` function can now be used on `data` to compute asymmetric data matrices, containing the number of times a specific type of social interaction was initiated by the row subject and directed to the column subject (target), separately for each social interaction and for each observer. Data matrices are stored inside a list (e.g., **observations**).

``` {r}
  data2 <- countb(data)
  data2
```

`data2` is a list of lists: one for each observer (in this example ``data2$`1` `` and ``data2$`2` ``). Inside each list there is one asymmetric interaction matrix per social interaction recorded (e.g., ``data2$`1`$`-` ``). Cells in these matrices provide counts on the number of times a specific type of social interaction was initiated by the row subject and directed to the column subject.

See `?countb` for further details on the `countb()` function.

## Contact

For more help or any further questions about this package the user can e-mail the maintainer: davidnsousa@gmail.com. To contribute to this package the user can fork the package github repository and propose changes.

Owner

  • Name: David Sousa
  • Login: davidnsousa
  • Kind: user

JOSS Publication

bor: An R Package for Transforming Behavioral Observation Records into Data Matrices
Published
August 29, 2018
Volume 3, Issue 28, Page 909
Authors
David N. Sousa ORCID
William James Center for Research, ISPA - Instituto Universitário
João R. Daniel ORCID
William James Center for Research, ISPA - Instituto Universitário
Editor
Karthik Ram ORCID
Tags
focal sample social behavior

GitHub Events

Total
Last Year

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 38
  • Total Committers: 2
  • Avg Commits per committer: 19.0
  • Development Distribution Score (DDS): 0.026
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
David N. Sousa d****a@g****m 37
joaordaniel j****l@g****m 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 1
  • Total pull requests: 1
  • Average time to close issues: 2 months
  • Average time to close pull requests: 27 minutes
  • Total issue authors: 1
  • Total pull request authors: 1
  • Average comments per issue: 1.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • ViniciusBRodrigues (1)
Pull Request Authors
  • joaordaniel (1)
Top Labels
Issue Labels
Pull Request Labels