Skip to contents

Accessing columns, rows, or cells via $, [[, or [ is mostly similar to regular data frames. However, the behavior is sometimes different for track tables based on tibble and data.table. For more info, refer to tibble's and data.table's subsetting documentation.

Usage

# S3 method for track
[(x, ...)

# S3 method for track
[(x, ...) <- value

Arguments

x

A track table.

...

Other parameters to be passed to the extracting/subsetting functions of data.frame, tibble, and data.table.

value

A suitable replacement value: it will be repeated a whole number of times if necessary and it may be coerced: see the `Coercion` section in data.frame. If `NULL`, deletes the column if a single column is selected.

Value

A subset of the track table is [ is called, or a modified version of the track table if [<- is called.

Author

Simon Garnier, garnier@njit.edu

Examples

data(short_tracks)

short_tracks[1]
#>      id
#> 56    1
#> 57    1
#> 58    1
#> 59    1
#> 60    1
#> 61    1
#> 62    1
#> 63    1
#> 64    1
#> 65    1
#> 66    1
#> 67    1
#> 68    1
#> 69    1
#> 70    1
#> 71    1
#> 72    1
#> 73    1
#> 74    1
#> 75    1
#> 76    1
#> 77    1
#> 78    1
#> 79    1
#> 80    1
#> 81    1
#> 82    1
#> 83    1
#> 84    1
#> 85    1
#> 86    1
#> 87    1
#> 88    1
#> 89    1
#> 90    1
#> 91    1
#> 92    1
#> 93    1
#> 94    1
#> 95    1
#> 96    1
#> 97    1
#> 98    1
#> 99    1
#> 100   1
#> 101   1
#> 102   1
#> 103   1
#> 104   1
#> 105   1
#> 106   1
#> 107   1
#> 108   1
#> 109   1
#> 110   1
#> 111   1
#> 112   1
#> 113   1
#> 114   1
#> 115   1
#> 3656  2
#> 3657  2
#> 3658  2
#> 3659  2
#> 3660  2
#> 3661  2
#> 3662  2
#> 3663  2
#> 3664  2
#> 3665  2
#> 3666  2
#> 3667  2
#> 3668  2
#> 3669  2
#> 3670  2
#> 3671  2
#> 3672  2
#> 3673  2
#> 3674  2
#> 3675  2
#> 3676  2
#> 3677  2
#> 3678  2
#> 3679  2
#> 3680  2
#> 3681  2
#> 3682  2
#> 3683  2
#> 3684  2
#> 3685  2
#> 3686  2
#> 3687  2
#> 3688  2
#> 3689  2
#> 3690  2
#> 3691  2
#> 3692  2
#> 3693  2
#> 3694  2
#> 3695  2
#> 3696  2
#> 3697  2
#> 3698  2
#> 3699  2
#> 3700  2
#> 3701  2
#> 3702  2
#> 3703  2
#> 3704  2
#> 3705  2
#> 3706  2
#> 3707  2
#> 3708  2
#> 3709  2
#> 3710  2
#> 3711  2
#> 3712  2
#> 3713  2
#> 3714  2
#> 3715  2
short_tracks[1, ]
#> Track table [1 observations]
#> Number of tracks:  1 
#> Dimensions:  2D 
#> Geographic:  TRUE 
#> Projection:  +proj=longlat 
#> Table class:  data frame ('data.frame')
#>    id                   t        x         y
#> 56  1 2015-09-10 07:01:00 15.76468 -22.37961
short_tracks[1, 1]
#> [1] "1"
short_tracks$id[short_tracks$id == "1"] <- "0"
short_tracks[short_tracks[, 1] == "0", 1] <- "1"