Skip to contents

Methods of generic function summary for objects of spectral classes and of classes for collections of spectra.

Usage

# S3 method for class 'generic_spct'
summary(
  object,
  maxsum = 7,
  digits = max(3, getOption("digits") - 3),
  ...,
  expand = "none"
)

# S3 method for class 'generic_mspct'
summary(
  object,
  maxsum = 7,
  digits = max(3, getOption("digits") - 3),
  idx = "spct.idx",
  which.metadata = NULL,
  expand = "none",
  ...
)

Arguments

object

An object of one of the spectral classes for which a summary is desired.

maxsum

integer Indicates how many levels should be shown for factors.

digits

integer Used for number formatting with format().

...

additional arguments affecting the summary produced, ignored in current version.

expand

character One of "none", "collection", "each" or "auto" indicating if multiple spectra in long form should be summarized as a collection or individually.

idx

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

which.metadata

character vector Names of attributes to retrieve, or "none" or "all". Obeyed if expand = FALSE, its default.

Value

A summary object matching the class of object, or a list of such objects or a summary object for a matching collection of spectra. Metadata stored in attributes are copied to identical attributes in the returned summary objects except when object is a collection of spectra or if expand = "collection" is passed in the call. In this two cases, a condensed summary is returned as a data frame and attributes from each member can be copied to variables in it.

Details

Objects are summarized as is, ignoring the current settings of R options photobiology.radiation.unit and photobiology.filter.qty. Unlike R's summary, these methods can optionally summarize each spectrum stored in long form returning a list of summaries. Although this is frequently the most informative approach, the default remains similar to summary() method from R: to summarize object as a whole. Alternatively, multiple spectra stored in long form, can optionally be summarized also as a collection of spectra. Passing "auto" in the call, is equivalent to passing "each" or "collection" depending on the number of spectra contained in the object.

Functions

  • summary(generic_mspct):

Examples

summary(sun.spct)
#> Summary of source_spct [522 x 3] object: sun.spct
#> Wavelength range 280-800 nm, step 0.9230769-1 nm
#> Label: sunlight, simulated 
#> Measured on 2010-06-22 09:51:00 UTC 
#> Measured at 60.20911 N, 24.96474 E; Kumpula, Helsinki, FI 
#> Variables:
#>  w.length: Wavelength [nm]
#>  s.e.irrad: Spectral energy irradiance [W m-2 nm-1]
#>  s.q.irrad: Spectral photon irradiance [mol s-1 m-2 nm-1] 
#> --
#>     w.length       s.e.irrad        s.q.irrad        
#>  Min.   :280.0   Min.   :0.0000   Min.   :0.000e+00  
#>  1st Qu.:409.2   1st Qu.:0.4115   1st Qu.:1.980e-06  
#>  Median :539.5   Median :0.5799   Median :2.929e-06  
#>  Mean   :539.5   Mean   :0.5160   Mean   :2.407e-06  
#>  3rd Qu.:669.8   3rd Qu.:0.6664   3rd Qu.:3.155e-06  
#>  Max.   :800.0   Max.   :0.8205   Max.   :3.375e-06  
class(summary(sun.spct))
#> [1] "summary_source_spct"  "summary_generic_spct" "list"                

summary(two_filters.spct)
#> Summary of filter_spct [879 x 3] object: two_filters.spct
#> containing  2  spectra in long form
#> Wavelength range 240-800 nm, step -610-67 nm
#> spct_1 label: Polyester, clear film, 0.000125 m thick, Autostat CT5 from McDermit Autotype; new
#> spct_2 label: Theatrical 'gel', type 'Canary Supergel no312; new; from Rosco, UK 
#> Variables:
#>  w.length: Wavelength [nm]
#>  Tfr: Total spectral transmittance [/1] 
#> --
#>     w.length          Tfr            spct.idx  
#>  Min.   :190.0   Min.   :0.00001   spct_1:454  
#>  1st Qu.:359.5   1st Qu.:0.00400   spct_2:425  
#>  Median :492.0   Median :0.89664               
#>  Mean   :496.6   Mean   :0.58450               
#>  3rd Qu.:643.5   3rd Qu.:0.91429               
#>  Max.   :800.0   Max.   :0.92543               
class(summary(two_filters.spct))
#> [1] "summary_filter_spct"  "summary_generic_spct" "list"                

summary(sun_evening.spct)
#> Summary of source_spct [7,965 x 3] object: sun_evening.spct
#> containing  5  spectra in long form
#> Wavelength range 290-1000 nm, step 0.34-0.47 nm
#> Label: cosine.hour.9 
#> time.01 measured on 2023-06-12 18:38:00.379657 UTC
#> time.02 measured on 2023-06-12 18:39:00.797266 UTC
#> time.03 measured on 2023-06-12 18:40:00.714554 UTC
#> time.04 measured on 2023-06-12 18:41:00.768459 UTC
#> time.05 measured on 2023-06-12 18:42:00.769065 UTC 
#> Measured at 60.227 N, 24.018 E; Viikki, Helsinki, FI 
#> Variables:
#>  w.length: Wavelength [nm]
#>  s.e.irrad: Spectral energy irradiance [W m-2 nm-1] 
#> --
#>     w.length        s.e.irrad          spct.idx   
#>  Min.   : 290.0   Min.   :0.00000   time.01:1593  
#>  1st Qu.: 474.4   1st Qu.:0.02315   time.02:1593  
#>  Median : 654.8   Median :0.03892   time.03:1593  
#>  Mean   : 651.6   Mean   :0.03659   time.04:1593  
#>  3rd Qu.: 830.3   3rd Qu.:0.04888   time.05:1593  
#>  Max.   :1000.0   Max.   :0.07503                 
summary(two_filters.spct, expand = "none")
#> Summary of filter_spct [879 x 3] object: two_filters.spct
#> containing  2  spectra in long form
#> Wavelength range 240-800 nm, step -610-67 nm
#> spct_1 label: Polyester, clear film, 0.000125 m thick, Autostat CT5 from McDermit Autotype; new
#> spct_2 label: Theatrical 'gel', type 'Canary Supergel no312; new; from Rosco, UK 
#> Variables:
#>  w.length: Wavelength [nm]
#>  Tfr: Total spectral transmittance [/1] 
#> --
#>     w.length          Tfr            spct.idx  
#>  Min.   :190.0   Min.   :0.00001   spct_1:454  
#>  1st Qu.:359.5   1st Qu.:0.00400   spct_2:425  
#>  Median :492.0   Median :0.89664               
#>  Mean   :496.6   Mean   :0.58450               
#>  3rd Qu.:643.5   3rd Qu.:0.91429               
#>  Max.   :800.0   Max.   :0.92543               
summary(two_filters.spct, expand = "each")
#> $spct_1
#> Summary of filter_spct [454 x 2] object: anonymous
#> Wavelength range 240-800 nm, step 1-4 nm
#> Label: Polyester, clear film, 0.000125 m thick, Autostat CT5 from McDermit Autotype; new 
#> Variables:
#>  w.length: Wavelength [nm]
#>  Tfr: Total spectral transmittance [/1] 
#> --
#>     w.length          Tfr        
#>  Min.   :240.0   Min.   :0.0030  
#>  1st Qu.:376.2   1st Qu.:0.8920  
#>  Median :513.5   Median :0.9140  
#>  Mean   :519.1   Mean   :0.7835  
#>  3rd Qu.:661.8   3rd Qu.:0.9211  
#>  Max.   :800.0   Max.   :0.9254  
#> 
#> $spct_2
#> Summary of filter_spct [425 x 2] object: anonymous
#> Wavelength range 190-800 nm, step 1-4 nm
#> Label: Theatrical 'gel', type 'Canary Supergel no312; new; from Rosco, UK 
#> Variables:
#>  w.length: Wavelength [nm]
#>  Tfr: Total spectral transmittance [/1] 
#> --
#>     w.length          Tfr         
#>  Min.   :190.0   Min.   :0.00001  
#>  1st Qu.:314.0   1st Qu.:0.00001  
#>  Median :473.0   Median :0.01421  
#>  Mean   :472.4   Mean   :0.37195  
#>  3rd Qu.:603.0   3rd Qu.:0.89521  
#>  Max.   :800.0   Max.   :0.90179  
#> 
summary(two_filters.spct, expand = "collection")
#> Summary of filter_mspct [2 x 1] object: anonymous
#> # A tibble: 2 × 8
#>   spct.idx class   dim   w.length.min w.length.max colnames multiple.wl Tfr.type
#>   <chr>    <chr>   <chr>        <int>        <int> <list>         <dbl> <chr>   
#> 1 spct_1   filter… [454…          240          800 <chr>              1 total   
#> 2 spct_2   filter… [425…          190          800 <chr>              1 total   
summary(two_filters.spct, expand = "auto") # <= 4 spectra
#> $spct_1
#> Summary of filter_spct [454 x 2] object: anonymous
#> Wavelength range 240-800 nm, step 1-4 nm
#> Label: Polyester, clear film, 0.000125 m thick, Autostat CT5 from McDermit Autotype; new 
#> Variables:
#>  w.length: Wavelength [nm]
#>  Tfr: Total spectral transmittance [/1] 
#> --
#>     w.length          Tfr        
#>  Min.   :240.0   Min.   :0.0030  
#>  1st Qu.:376.2   1st Qu.:0.8920  
#>  Median :513.5   Median :0.9140  
#>  Mean   :519.1   Mean   :0.7835  
#>  3rd Qu.:661.8   3rd Qu.:0.9211  
#>  Max.   :800.0   Max.   :0.9254  
#> 
#> $spct_2
#> Summary of filter_spct [425 x 2] object: anonymous
#> Wavelength range 190-800 nm, step 1-4 nm
#> Label: Theatrical 'gel', type 'Canary Supergel no312; new; from Rosco, UK 
#> Variables:
#>  w.length: Wavelength [nm]
#>  Tfr: Total spectral transmittance [/1] 
#> --
#>     w.length          Tfr         
#>  Min.   :190.0   Min.   :0.00001  
#>  1st Qu.:314.0   1st Qu.:0.00001  
#>  Median :473.0   Median :0.01421  
#>  Mean   :472.4   Mean   :0.37195  
#>  3rd Qu.:603.0   3rd Qu.:0.89521  
#>  Max.   :800.0   Max.   :0.90179  
#> 
summary(sun_evening.spct, expand = "auto") # > 4 spectra
#> Summary of source_mspct [5 x 1] object: anonymous
#> # A tibble: 5 × 8
#>   spct.idx class  dim   w.length.min w.length.max colnames multiple.wl time.unit
#>   <chr>    <chr>  <chr>        <dbl>        <dbl> <list>         <dbl> <chr>    
#> 1 time.01  sourc… [1,5…          290        1000. <chr>              1 second   
#> 2 time.02  sourc… [1,5…          290        1000. <chr>              1 second   
#> 3 time.03  sourc… [1,5…          290        1000. <chr>              1 second   
#> 4 time.04  sourc… [1,5…          290        1000. <chr>              1 second   
#> 5 time.05  sourc… [1,5…          290        1000. <chr>              1 second   

where_measured(sun.spct)
#> # A tibble: 1 × 3
#>     lat   lon address              
#>   <dbl> <dbl> <chr>                
#> 1  60.2  25.0 Kumpula, Helsinki, FI
where_measured(summary(sun.spct))
#> # A tibble: 1 × 3
#>     lat   lon address              
#>   <dbl> <dbl> <chr>                
#> 1  60.2  25.0 Kumpula, Helsinki, FI
what_measured(summary(two_filters.spct))
#> $spct_1
#> [1] "Polyester, clear film, 0.000125 m thick, Autostat CT5 from McDermit Autotype; new"
#> 
#> $spct_2
#> [1] "Theatrical 'gel', type 'Canary Supergel no312; new; from Rosco, UK"
#> 
what_measured(summary(two_filters.spct, expand = "each")[[1]])
#> [1] "Polyester, clear film, 0.000125 m thick, Autostat CT5 from McDermit Autotype; new"

summary(sun_evening.mspct)
#> Summary of source_mspct [5 x 1] object: sun_evening.mspct
#> # A tibble: 5 × 8
#>   spct.idx class  dim   w.length.min w.length.max colnames multiple.wl time.unit
#>   <chr>    <chr>  <chr>        <dbl>        <dbl> <list>         <dbl> <chr>    
#> 1 time.01  sourc… [1,5…          290        1000. <chr>              1 second   
#> 2 time.02  sourc… [1,5…          290        1000. <chr>              1 second   
#> 3 time.03  sourc… [1,5…          290        1000. <chr>              1 second   
#> 4 time.04  sourc… [1,5…          290        1000. <chr>              1 second   
#> 5 time.05  sourc… [1,5…          290        1000. <chr>              1 second   
summary(sun_evening.mspct, which.metadata = "when.measured")
#> Summary of source_mspct [5 x 1] object: sun_evening.mspct
#> # A tibble: 5 × 7
#>   spct.idx class    dim   w.length.min w.length.max colnames when.measured      
#>   <chr>    <chr>    <chr>        <dbl>        <dbl> <list>   <dttm>             
#> 1 time.01  source_… [1,5…          290        1000. <chr>    2023-06-12 18:38:00
#> 2 time.02  source_… [1,5…          290        1000. <chr>    2023-06-12 18:39:00
#> 3 time.03  source_… [1,5…          290        1000. <chr>    2023-06-12 18:40:00
#> 4 time.04  source_… [1,5…          290        1000. <chr>    2023-06-12 18:41:00
#> 5 time.05  source_… [1,5…          290        1000. <chr>    2023-06-12 18:42:00
summary(two_filters.mspct, which.metadata = "what.measured")
#> Summary of filter_mspct [2 x 1] object: two_filters.mspct
#> # A tibble: 2 × 7
#>   spct.idx class       dim      w.length.min w.length.max colnames what.measured
#>   <chr>    <chr>       <chr>           <int>        <int> <list>   <chr>        
#> 1 spct_1   filter_spct [454 x …          240          800 <chr>    Polyester, c…
#> 2 spct_2   filter_spct [425 x …          190          800 <chr>    Theatrical '…
summary(two_filters.mspct, expand = "each")
#> $spct_1
#> Summary of filter_spct [454 x 2] object: anonymous
#> Wavelength range 240-800 nm, step 1-4 nm
#> Label: Polyester, clear film, 0.000125 m thick, Autostat CT5 from McDermit Autotype; new 
#> Variables:
#>  w.length: Wavelength [nm]
#>  Tfr: Total spectral transmittance [/1] 
#> --
#>     w.length          Tfr        
#>  Min.   :240.0   Min.   :0.0030  
#>  1st Qu.:376.2   1st Qu.:0.8920  
#>  Median :513.5   Median :0.9140  
#>  Mean   :519.1   Mean   :0.7835  
#>  3rd Qu.:661.8   3rd Qu.:0.9211  
#>  Max.   :800.0   Max.   :0.9254  
#> 
#> $spct_2
#> Summary of filter_spct [425 x 2] object: anonymous
#> Wavelength range 190-800 nm, step 1-4 nm
#> Label: Theatrical 'gel', type 'Canary Supergel no312; new; from Rosco, UK 
#> Variables:
#>  w.length: Wavelength [nm]
#>  Tfr: Total spectral transmittance [/1] 
#> --
#>     w.length          Tfr         
#>  Min.   :190.0   Min.   :0.00001  
#>  1st Qu.:314.0   1st Qu.:0.00001  
#>  Median :473.0   Median :0.01421  
#>  Mean   :472.4   Mean   :0.37195  
#>  3rd Qu.:603.0   3rd Qu.:0.89521  
#>  Max.   :800.0   Max.   :0.90179  
#>