Skip to contents

Method to read the "where.measured" attribute of generic_spct, generic_mspct, summary_generic_spct, data.frame or a derived-class object.

Usage

getWhereMeasured(x, ...)

where_measured(x, ...)

# Default S3 method
getWhereMeasured(x, ...)

# S3 method for class 'generic_spct'
getWhereMeasured(
  x,
  ...,
  idx = getIdFactor(x),
  simplify = TRUE,
  .bind.geocodes = TRUE
)

# S3 method for class 'summary_generic_spct'
getWhereMeasured(
  x,
  ...,
  idx = getIdFactor(x),
  simplify = TRUE,
  .bind.geocodes = TRUE
)

# S3 method for class 'generic_mspct'
getWhereMeasured(
  x,
  ...,
  idx = "spct.idx",
  .bind.geocodes = TRUE,
  simplify = FALSE
)

# S3 method for class 'data.frame'
getWhereMeasured(x, ...)

Arguments

x

a generic_spct object

...

Allows use of additional arguments in methods for other classes.

idx

character Name of the column with the names of the members of the collection of spectra.

simplify

logical If all members share the same attribute value return one copy instead of a data.frame.

.bind.geocodes

logical In the case of collections of spectra if .bind.geocodes = TRUE, the default, the returned value is a single geocode with one row for each member spectrum. Otherwise the individual geocode data frames are returned in a list column within a tibble.

Value

a data.frame with a single row and at least columns "lon" and "lat", unless expand is set to FALSE.

Methods (by class)

  • getWhereMeasured(default): default

  • getWhereMeasured(generic_spct): generic_spct

  • getWhereMeasured(summary_generic_spct): summary_generic_spct

  • getWhereMeasured(generic_mspct): generic_mspct

  • getWhereMeasured(data.frame): data.frame

Note

If x is not a generic_spct or an object of a derived class NA is returned.

Examples

getWhereMeasured(sun.spct)
#> # A tibble: 1 × 3
#>     lat   lon address              
#>   <dbl> <dbl> <chr>                
#> 1  60.2  25.0 Kumpula, Helsinki, FI
getWhereMeasured(sun_evening.spct)
#> # A tibble: 1 × 3
#>     lat   lon address             
#>   <dbl> <dbl> <chr>               
#> 1  60.2  24.0 Viikki, Helsinki, FI
getWhereMeasured(sun_evening.spct, simplify = TRUE)
#> # A tibble: 1 × 3
#>     lat   lon address             
#>   <dbl> <dbl> <chr>               
#> 1  60.2  24.0 Viikki, Helsinki, FI
getWhereMeasured(sun_evening.mspct)
#> # A tibble: 5 × 4
#>   spct.idx   lat   lon address             
#>   <fct>    <dbl> <dbl> <chr>               
#> 1 time.01   60.2  24.0 Viikki, Helsinki, FI
#> 2 time.02   60.2  24.0 Viikki, Helsinki, FI
#> 3 time.03   60.2  24.0 Viikki, Helsinki, FI
#> 4 time.04   60.2  24.0 Viikki, Helsinki, FI
#> 5 time.05   60.2  24.0 Viikki, Helsinki, FI
getWhereMeasured(sun_evening.mspct, .bind.geocodes = FALSE)
#> $time.01
#> # A tibble: 1 × 3
#>     lat   lon address             
#>   <dbl> <dbl> <chr>               
#> 1  60.2  24.0 Viikki, Helsinki, FI
#> 
#> $time.02
#> # A tibble: 1 × 3
#>     lat   lon address             
#>   <dbl> <dbl> <chr>               
#> 1  60.2  24.0 Viikki, Helsinki, FI
#> 
#> $time.03
#> # A tibble: 1 × 3
#>     lat   lon address             
#>   <dbl> <dbl> <chr>               
#> 1  60.2  24.0 Viikki, Helsinki, FI
#> 
#> $time.04
#> # A tibble: 1 × 3
#>     lat   lon address             
#>   <dbl> <dbl> <chr>               
#> 1  60.2  24.0 Viikki, Helsinki, FI
#> 
#> $time.05
#> # A tibble: 1 × 3
#>     lat   lon address             
#>   <dbl> <dbl> <chr>               
#> 1  60.2  24.0 Viikki, Helsinki, FI
#> 
getWhereMeasured(sun_evening.mspct, simplify = TRUE)
#> # A tibble: 1 × 3
#>     lat   lon address             
#>   <dbl> <dbl> <chr>               
#> 1  60.2  24.0 Viikki, Helsinki, FI
getWhereMeasured(sun_evening.mspct, simplify = FALSE)
#> # A tibble: 5 × 4
#>   spct.idx   lat   lon address             
#>   <fct>    <dbl> <dbl> <chr>               
#> 1 time.01   60.2  24.0 Viikki, Helsinki, FI
#> 2 time.02   60.2  24.0 Viikki, Helsinki, FI
#> 3 time.03   60.2  24.0 Viikki, Helsinki, FI
#> 4 time.04   60.2  24.0 Viikki, Helsinki, FI
#> 5 time.05   60.2  24.0 Viikki, Helsinki, FI

getWhereMeasured(summary(sun.spct))
#> # A tibble: 1 × 3
#>     lat   lon address              
#>   <dbl> <dbl> <chr>                
#> 1  60.2  25.0 Kumpula, Helsinki, FI
getWhereMeasured(summary(sun_evening.spct))
#> # A tibble: 1 × 3
#>     lat   lon address             
#>   <dbl> <dbl> <chr>               
#> 1  60.2  24.0 Viikki, Helsinki, FI
getWhereMeasured(summary(sun_evening.mspct, expand = "each")[[1]])
#> # A tibble: 1 × 3
#>     lat   lon address             
#>   <dbl> <dbl> <chr>               
#> 1  60.2  24.0 Viikki, Helsinki, FI

getWhereMeasured(polyester.spct)
#> # A tibble: 1 × 3
#>     lon   lat address
#>   <dbl> <dbl> <chr>  
#> 1    NA    NA NA