This function acts similarly to dplyr::pull()
working on
mts$meta
or mts$data
. Data are returned as a simple array.
Data are pulled from whichever dataframe contains var
.
mts_pull(mts = NULL, var = NULL)
mts object.
A variable name found in the meta
or data
dataframe of the incoming mts time series object.
An array of values.
library(MazamaTimeSeries)
# Metadata
example_mts %>%
mts_pull("communityRegion") %>%
table() %>%
sort(decreasing = TRUE)
#> .
#> Alhambra/Monterey Park El Monte
#> 33 5
# Data for a specific ID
example_mts %>%
mts_pull("da4cadd2d6ea5302_4686")
#> [1] 14.663333 15.401333 15.686833 15.296000 15.114833 17.788833
#> [7] 21.004833 18.522167 17.653000 15.810500 13.441833 10.807167
#> [13] 10.745167 11.496500 11.156333 10.639333 8.921000 6.796000
#> [19] 6.370833 5.988500 8.295833 9.485333 11.110000 13.480000
#> [25] 13.868000 13.331500 13.064667 12.548500 12.192333 15.689500
#> [31] 15.849833 16.603333 17.109167 16.262833 16.695167 13.579000
#> [37] 10.796000 8.054333 9.215833 9.836500 9.688333 10.770667
#> [43] 13.091667 12.671333 15.421500 18.056833 16.396667 14.634500
#> [49] 13.701500 10.981500 9.594667 14.201333 15.973500 14.861333
#> [55] 15.208000 15.315167 16.539500 19.770333 19.909500 15.702167
#> [61] 16.110667 14.887167 14.322333 21.644667 15.260500 13.226833
#> [67] 13.733000 13.754000 14.940500 16.907667 24.405333 17.149667
#> [73] 12.242333 11.167500 11.962000 11.255333 11.068500 11.473167
#> [79] 11.654667 11.577333 13.287500 15.133667 16.046167 16.543167
#> [85] 17.240500 16.374833 16.127333 16.121000 14.960167 16.892000
#> [91] 18.983000 21.372000 59.664500 172.851000 212.026333 145.572667
#> [97] 93.067667 65.081000 48.351000 45.551500 53.586000 75.637667
#> [103] 110.198833 125.826167 118.064667 83.203000 37.408333 28.654667
#> [109] 20.489000 17.698000 17.750833 16.996667 14.683833 13.601333
#> [115] 15.170500 19.678000 23.070833 23.320000 20.673833 20.280667
#> [121] 20.995667 16.947833 16.298833 25.653500 31.316500 32.088167
#> [127] 33.678000 34.094500 36.458667 33.557500 33.172500 32.573000
#> [133] 32.464167 35.256333 33.378667 22.659833 17.496667 16.681667
#> [139] 19.408667 21.635000 26.086667 29.953500 34.675500 36.420000
#> [145] 24.230333 22.273000 22.163000 22.780667 22.128833 24.421833
#> [151] 21.524667 16.482667 16.653167 16.998167 18.517167 18.119333
#> [157] 18.657333 21.494667 21.607667 18.470667 19.351833 18.665667
#> [163] 17.196667 16.438667 14.380333 13.440500 15.840333 16.342000