The active group is the combination of group names to group the data sets. The active_group acts essentially like a paste(names_of_groups, sep = '_') grouping variable.

active_group(x)

Arguments

x

a c_grouping

Examples

#'
data("raccoon")
raccoon$timestamp <- as.POSIXct(raccoon$timestamp, "EST")
burstz <- list(id = raccoon$animal_id, month = as.POSIXlt(raccoon$timestamp)$mon)
mb1 <- make_c_grouping(x = burstz, active_group = c("id", "month"))

# see the current active burst
active_group(mb1)
#> [1] "id"    "month"

# change the active burst
active_group(mb1) <- "id"

# Using a full data set
my_track <- as_sftrack(raccoon,
  time = "timestamp",
  error = NA, coords = c("longitude", "latitude"),
  group = burstz
)

summary(my_track)
#>   animal_id            latitude       longitude     
#>  Length:445         Min.   :26.07   Min.   :-80.28  
#>  Class :character   1st Qu.:26.07   1st Qu.:-80.28  
#>  Mode  :character   Median :26.07   Median :-80.28  
#>                     Mean   :26.07   Mean   :-80.28  
#>                     3rd Qu.:26.07   3rd Qu.:-80.28  
#>                     Max.   :26.08   Max.   :-80.27  
#>                     NA's   :168     NA's   :168     
#>    timestamp                          height             hdop      
#>  Min.   :2019-01-19 00:02:30.00   Min.   : -30.00   Min.   :0.000  
#>  1st Qu.:2019-01-22 07:02:30.00   1st Qu.:   1.00   1st Qu.:0.000  
#>  Median :2019-01-25 23:02:30.00   Median :   7.00   Median :1.300  
#>  Mean   :2019-01-25 22:22:18.39   Mean   :  36.65   Mean   :1.691  
#>  3rd Qu.:2019-01-29 07:02:09.00   3rd Qu.:  15.50   3rd Qu.:2.500  
#>  Max.   :2019-02-01 23:02:30.00   Max.   :1107.00   Max.   :9.900  
#>                                   NA's   :198                      
#>       vdop       fix                        sft_group      geometry  
#>  Min.   :0.000   2D: 37   TTP-041_0              :208   POINT  :445  
#>  1st Qu.:0.000   3D:240   TTP-041_1              : 15   epsg:NA:  0  
#>  Median :1.900   NO:168   TTP-058_0              :207                
#>  Mean   :1.938            TTP-058_1              : 15                
#>  3rd Qu.:3.200            active_group: id, month:  0                
#>  Max.   :8.400                                                       
#>                                                                      

# change active group
active_group(my_track$sft_group) <- "id"

summary(my_track)
#>   animal_id            latitude       longitude     
#>  Length:445         Min.   :26.07   Min.   :-80.28  
#>  Class :character   1st Qu.:26.07   1st Qu.:-80.28  
#>  Mode  :character   Median :26.07   Median :-80.28  
#>                     Mean   :26.07   Mean   :-80.28  
#>                     3rd Qu.:26.07   3rd Qu.:-80.28  
#>                     Max.   :26.08   Max.   :-80.27  
#>                     NA's   :168     NA's   :168     
#>    timestamp                          height             hdop      
#>  Min.   :2019-01-19 00:02:30.00   Min.   : -30.00   Min.   :0.000  
#>  1st Qu.:2019-01-22 07:02:30.00   1st Qu.:   1.00   1st Qu.:0.000  
#>  Median :2019-01-25 23:02:30.00   Median :   7.00   Median :1.300  
#>  Mean   :2019-01-25 22:22:18.39   Mean   :  36.65   Mean   :1.691  
#>  3rd Qu.:2019-01-29 07:02:09.00   3rd Qu.:  15.50   3rd Qu.:2.500  
#>  Max.   :2019-02-01 23:02:30.00   Max.   :1107.00   Max.   :9.900  
#>                                   NA's   :198                      
#>       vdop       fix                 sft_group      geometry  
#>  Min.   :0.000   2D: 37   TTP-041         :223   POINT  :445  
#>  1st Qu.:0.000   3D:240   TTP-058         :222   epsg:NA:  0  
#>  Median :1.900   NO:168   active_group: id:  0                
#>  Mean   :1.938                                                
#>  3rd Qu.:3.200                                                
#>  Max.   :8.400                                                
#>