项目作者: robitalec

项目描述 :
:package: hwig is an R package for calculating gregariousness adjusted half-weight index.
高级语言: R
项目地址: git://github.com/robitalec/hwig.git
创建时间: 2019-03-04T23:35:22Z
项目社区:https://github.com/robitalec/hwig

开源协议:Other

下载


hwig

Calculates the half-weight index gregariousness (HWIG) as described in
Godde et al. (2013) [1].

Installation

  1. devtools::install_gitlab('robit.a/hwig')
  2. # CRAN
  3. install.packages('hwig')

Usage

  1. # Load packages
  2. library(hwig)
  3. library(data.table)
  4. # Load example data
  5. DT <- fread(system.file("extdata", "DT.csv", package = "hwig"))
  6. # Calculate HWI
  7. hwi <- calc_hwi(DT, 'id', 'group', 'yr')
  8. #> Generating 10 x 10 matrix
  9. #> Generating 10 x 10 matrix
  10. # Calculate HWIG
  11. hwig <- calc_hwig(hwi)
  12. # Set names
  13. nms <- get_names(DT, 'yr')
  14. names(hwig) <- nms
  15. # Print first year's result
  16. hwig[1]
  17. #> $`2016`
  18. #> A B C D E F G H I J
  19. #> 0.0000 0.000 1.0006 0 0.6857 1.3337 0.000 0.2727 1.5114 1.000
  20. #> 0.0000 0.000 0.0000 0 0.0000 0.0000 3.058 0.0000 0.0000 0.000
  21. #> 1.0006 0.000 0.0000 0 0.0000 1.1153 0.000 0.8868 1.3630 0.000
  22. #> 0.0000 0.000 0.0000 0 0.0000 0.0000 0.000 0.0000 0.0000 0.000
  23. #> 0.6857 0.000 0.0000 0 0.0000 0.5944 0.000 2.2281 0.4953 0.000
  24. #> 1.3337 0.000 1.1153 0 0.5944 0.0000 0.000 0.4728 0.6936 0.000
  25. #> 0.0000 3.058 0.0000 0 0.0000 0.0000 0.000 0.0000 0.0000 0.000
  26. #> 0.2727 0.000 0.8868 0 2.2281 0.4728 0.000 0.0000 0.6303 1.773
  27. #> 1.5114 0.000 1.3630 0 0.4953 0.6936 0.000 0.6303 0.0000 0.867
  28. #> 1.0001 0.000 0.0000 0 0.0000 0.0000 0.000 1.7727 0.8670 0.000

References

[1] Sophie Godde, Lionel Humbert, Steeve D. Côté, Denis Réale, Hal
Whitehead. Correcting for the impact of gregariousness in social network
analyses. Animal Behaviour. Volume 85, Issue 3.
2013.