Skip to contents

Retrieve something contained in a glider object, or something that can be computed from what is contained there.

Usage

# S4 method for class 'glider'
x[[i, j, ...]]

Arguments

x

a glider object, i.e. one inheriting from glider.

i

a character value that names the item to be retrieved.

j

an optional character value specifying the data-stream to be used.

...

optional additional information (ignored).

Details

First, a check is done to see if the object's metadata contains an item with name given by i. If this is true, then that value is returned.

Otherwise, the item is sought somewhere within the data slot. This may be done within data directly for Slocum data or within data$payload or a similar name for SeaExplorer data. Note that [[ can retrieve not just the actual stored information, but also information that can be derived from that information. For example, gliders do not store Absolute Salinity or Conservative Temperature, but they can be retrieved with g[["SA"]] and g[["CT"]] respectively, where g is a glider object (see Example 1). Use e.g. g[["?"]] on a given glider object, to find out what items [[ can retrieve (see Example 2).

Author

Dan Kelley

Examples

library(oceglider)
directory <- system.file("extdata/sea_explorer/delayed_raw", package = "oceglider")
g <- read.glider.seaexplorer.delayed(directory, progressBar = FALSE)

# Example 1: look up Absolute Salinity
summary(g[["SA"]])
#>     Min.  1st Qu.   Median     Mean  3rd Qu.     Max.     NA's 
#>  0.00751  0.00882 32.38614 22.19193 32.40267 32.77709      194 

# Example 2: discover what can be retrieved from this object
# (FIXME: not all of these work)
g[["?"]]
#>  [1] "Absolute Salinity"        "CT"                      
#>  [3] "Conservative Temperature" "N2"                      
#>  [5] "Rrho"                     "RrhoSF"                  
#>  [7] "SA"                       "SP"                      
#>  [9] "SR"                       "Sstar"                   
#> [11] "backscatter"              "backscatterCount"        
#> [13] "cdom"                     "cdomCount"               
#> [15] "chlorophyll"              "chlorophyllCount"        
#> [17] "conductivity"             "density"                 
#> [19] "depth"                    "latitude"                
#> [21] "longitude"                "navState"                
#> [23] "oxygen"                   "oxygenFrequency"         
#> [25] "oxygenTemperature"        "potential temperature"   
#> [27] "pressure"                 "pressureNav"             
#> [29] "salinity"                 "sigma0"                  
#> [31] "sigma1"                   "sigma2"                  
#> [33] "sigma3"                   "sigma4"                  
#> [35] "sigmaTheta"               "sound speed"             
#> [37] "spice"                    "spiciness0"              
#> [39] "spiciness1"               "spiciness2"              
#> [41] "temperature"              "theta"                   
#> [43] "time"                     "yoNumber"                
#> [45] "z"