Generate series-level descriptive statistics for fhx object

series_stats(
  x,
  func_list = list(first = first_year, last = last_year, years = count_year_span,
    inner_type = inner_type, outer_type = outer_type, number_scars = count_scar,
    number_injuries = count_injury, recording_years = count_recording, mean_interval =
    series_mean_interval)
)

Arguments

x

An fhx object.

func_list

A list of named functions that will be run on each series in the fhx object. The list name for each function is the corresponding column name in the output data frame.

Value

A data.frame containing series-level statistics.

See also

Examples

data(lgr2)
series_stats(lgr2)
#>    series first last years inner_type outer_type number_scars number_injuries
#> 1   LGR54  1366 1482   117 inner_year outer_year            0               1
#> 2   LGR44  1411 1503    93 inner_year outer_year            2               0
#> 3   LGR47  1580 1770   191  pith_year outer_year            0               0
#> 4   LGR48  1701 1804   104  pith_year outer_year            0               1
#> 5   LGR46  1705 1849   145  pith_year outer_year            3               0
#> 6   LGR41  1721 1853   133  pith_year outer_year            0               1
#> 7   LGR52  1758 1837    80  pith_year outer_year            1               1
#> 8   LGR51  1759 1851    93  pith_year  bark_year            0               0
#> 9   LGR45  1760 1811    52 inner_year outer_year            0               1
#> 10  LGR49  1766 1826    61  pith_year outer_year            1               0
#> 11  LGR53  1772 1843    72  pith_year outer_year            1               0
#> 12  LGR43  1777 1860    84 inner_year  bark_year            1               0
#> 13  LGR55  1801 2012   212 inner_year  bark_year            0               1
#> 14  LGR56  1861 2011   151  pith_year  bark_year            0               0
#> 15  LGR36  1865 2011   147  pith_year  bark_year            0               0
#> 16  LGR33  1867 2011   145  pith_year  bark_year            0               0
#> 17  LGR31  1868 2011   144  pith_year  bark_year            0               0
#> 18  LGR32  1868 2011   144  pith_year  bark_year            0               0
#> 19  LGR27  1869 2011   143  pith_year  bark_year            0               0
#> 20  LGR29  1875 2012   138  pith_year  bark_year            0               0
#> 21  LGR25  1876 2011   136 inner_year  bark_year            0               0
#> 22  LGR35  1877 2011   135  pith_year  bark_year            0               0
#> 23  LGR30  1878 2011   134  pith_year  bark_year            0               0
#> 24  LGR26  1884 2011   128  pith_year  bark_year            0               0
#> 25  LGR42  1894 1970    77  pith_year outer_year            0               0
#> 26  LGR34  1904 2011   108 inner_year  bark_year            0               0
#>    recording_years mean_interval
#> 1               60            NA
#> 2               81          25.0
#> 3              191            NA
#> 4               53            NA
#> 5               77          16.5
#> 6               48            NA
#> 7               65            NA
#> 8               93            NA
#> 9                6            NA
#> 10              21            NA
#> 11              38            NA
#> 12              55            NA
#> 13             152            NA
#> 14             151            NA
#> 15             147            NA
#> 16             145            NA
#> 17             144            NA
#> 18             144            NA
#> 19             143            NA
#> 20             138            NA
#> 21             136            NA
#> 22             135            NA
#> 23             134            NA
#> 24             128            NA
#> 25              77            NA
#> 26             108            NA

# You can create your own list of statistics to output. You can also create
# your own functions:
flist <- list(
  n = count_year_span,
  xbar_interval = function(x) mean_interval(x, injury_event = TRUE)
)
sstats <- series_stats(lgr2)
head(sstats)
#>   series first last years inner_type outer_type number_scars number_injuries
#> 1  LGR54  1366 1482   117 inner_year outer_year            0               1
#> 2  LGR44  1411 1503    93 inner_year outer_year            2               0
#> 3  LGR47  1580 1770   191  pith_year outer_year            0               0
#> 4  LGR48  1701 1804   104  pith_year outer_year            0               1
#> 5  LGR46  1705 1849   145  pith_year outer_year            3               0
#> 6  LGR41  1721 1853   133  pith_year outer_year            0               1
#>   recording_years mean_interval
#> 1              60            NA
#> 2              81          25.0
#> 3             191            NA
#> 4              53            NA
#> 5              77          16.5
#> 6              48            NA