Helper function building on eemR::eem_names(). Extracts a specified
component from an eem or abs object.
Arguments
- x
An
eemlist,eem,abslist, orabsobject.- info
The name of the component to extract. See eemR::eem for base
eemcomponent names,abs_read()for baseabscomponent names, andadd_metadata()for extendedeemANDabsmetadata fields.
Value
if x is an eemlist or abslist:
If x is an eemlist or abslist, the returned structure depends on the
type of the requested component (info):
vector of length 1: returns a vector with one value per sample
vector of length >1: returns a matrix (samples in columns)
matrix: returns a list of matrices (one per sample)
matrix and
xis anabslist: returns a matrix (samples in columns)
If x is a single eem or abs object, the corresponding component is
returned as-is, preserving its class and structure.
Examples
# Get sample names
get_sample_info(example_eems, "sample")
#> [1] "B1S1ExampleBlankBEM" "B1S1ExampleBlankSEM"
#> [3] "B1S2ExampleTeaStdBEM" "B1S2ExampleTeaStdSEM"
#> [5] "B1S3ExampleSampleBEM" "B1S3ExampleSampleSEM"
#> [7] "ManualExampleTeaWaterfallPlotBlank" "ManualExampleTeaWaterfallPlotSample"
get_sample_info(example_abs, "sample")
#> [1] "B1S1ExampleBlankABS" "B1S2ExampleTeaStdABS"
#> [3] "B1S3ExampleSampleABS" "ManualExampleTeaAbsSpectraGraphs"
# Get analysis dates (metadata required)
eemlist <- add_metadata(metadata, example_eems)
get_sample_info(eemlist, "analysis_date")
#> [1] "2022-11-14 PST" "2022-11-14 PST" "2022-11-14 PST" "2022-11-14 PST"
#> [5] "2022-11-14 PST" "2022-11-14 PST" "2022-08-05 PDT" "2022-08-05 PDT"
# Get DOC for the fifth sample
get_sample_info(eemlist[[5]], "doc_mgL")
#> [1] 1.94
# Get emission wavelengths
get_sample_info(example_eems, "em")
#> B1S1ExampleBlankBEM B1S1ExampleBlankSEM B1S2ExampleTeaStdBEM
#> [1,] 247.926 247.926 247.926
#> [2,] 261.377 261.377 261.377
#> [3,] 274.861 274.861 274.861
#> [4,] 288.379 288.379 288.379
#> [5,] 301.930 301.930 301.930
#> [6,] 315.513 315.513 315.513
#> [7,] 329.127 329.127 329.127
#> [8,] 342.773 342.773 342.773
#> [9,] 356.449 356.449 356.449
#> [10,] 370.155 370.155 370.155
#> [11,] 383.891 383.891 383.891
#> [12,] 397.656 397.656 397.656
#> [13,] 411.449 411.449 411.449
#> [14,] 425.269 425.269 425.269
#> [15,] 439.117 439.117 439.117
#> [16,] 452.991 452.991 452.991
#> [17,] 466.891 466.891 466.891
#> [18,] 480.816 480.816 480.816
#> [19,] 494.766 494.766 494.766
#> [20,] 508.740 508.740 508.740
#> [21,] 522.737 522.737 522.737
#> [22,] 536.756 536.756 536.756
#> [23,] 550.798 550.798 550.798
#> [24,] 564.860 564.860 564.860
#> [25,] 578.943 578.943 578.943
#> [26,] 593.046 593.046 593.046
#> [27,] 607.168 607.168 607.168
#> [28,] 621.308 621.308 621.308
#> [29,] 635.466 635.466 635.466
#> [30,] 649.641 649.641 649.641
#> [31,] 663.832 663.832 663.832
#> [32,] 678.038 678.038 678.038
#> [33,] 692.258 692.258 692.258
#> [34,] 706.493 706.493 706.493
#> [35,] 720.740 720.740 720.740
#> [36,] 735.000 735.000 735.000
#> [37,] 749.271 749.271 749.271
#> [38,] 763.552 763.552 763.552
#> [39,] 777.843 777.843 777.843
#> [40,] 792.144 792.144 792.144
#> [41,] 806.452 806.452 806.452
#> [42,] 820.768 820.768 820.768
#> B1S2ExampleTeaStdSEM B1S3ExampleSampleBEM B1S3ExampleSampleSEM
#> [1,] 247.926 247.926 247.926
#> [2,] 261.377 261.377 261.377
#> [3,] 274.861 274.861 274.861
#> [4,] 288.379 288.379 288.379
#> [5,] 301.930 301.930 301.930
#> [6,] 315.513 315.513 315.513
#> [7,] 329.127 329.127 329.127
#> [8,] 342.773 342.773 342.773
#> [9,] 356.449 356.449 356.449
#> [10,] 370.155 370.155 370.155
#> [11,] 383.891 383.891 383.891
#> [12,] 397.656 397.656 397.656
#> [13,] 411.449 411.449 411.449
#> [14,] 425.269 425.269 425.269
#> [15,] 439.117 439.117 439.117
#> [16,] 452.991 452.991 452.991
#> [17,] 466.891 466.891 466.891
#> [18,] 480.816 480.816 480.816
#> [19,] 494.766 494.766 494.766
#> [20,] 508.740 508.740 508.740
#> [21,] 522.737 522.737 522.737
#> [22,] 536.756 536.756 536.756
#> [23,] 550.798 550.798 550.798
#> [24,] 564.860 564.860 564.860
#> [25,] 578.943 578.943 578.943
#> [26,] 593.046 593.046 593.046
#> [27,] 607.168 607.168 607.168
#> [28,] 621.308 621.308 621.308
#> [29,] 635.466 635.466 635.466
#> [30,] 649.641 649.641 649.641
#> [31,] 663.832 663.832 663.832
#> [32,] 678.038 678.038 678.038
#> [33,] 692.258 692.258 692.258
#> [34,] 706.493 706.493 706.493
#> [35,] 720.740 720.740 720.740
#> [36,] 735.000 735.000 735.000
#> [37,] 749.271 749.271 749.271
#> [38,] 763.552 763.552 763.552
#> [39,] 777.843 777.843 777.843
#> [40,] 792.144 792.144 792.144
#> [41,] 806.452 806.452 806.452
#> [42,] 820.768 820.768 820.768
#> ManualExampleTeaWaterfallPlotBlank ManualExampleTeaWaterfallPlotSample
#> [1,] 247.926 247.926
#> [2,] 261.377 261.377
#> [3,] 274.861 274.861
#> [4,] 288.379 288.379
#> [5,] 301.930 301.930
#> [6,] 315.513 315.513
#> [7,] 329.127 329.127
#> [8,] 342.773 342.773
#> [9,] 356.449 356.449
#> [10,] 370.155 370.155
#> [11,] 383.891 383.891
#> [12,] 397.656 397.656
#> [13,] 411.449 411.449
#> [14,] 425.269 425.269
#> [15,] 439.117 439.117
#> [16,] 452.991 452.991
#> [17,] 466.891 466.891
#> [18,] 480.816 480.816
#> [19,] 494.766 494.766
#> [20,] 508.740 508.740
#> [21,] 522.737 522.737
#> [22,] 536.756 536.756
#> [23,] 550.798 550.798
#> [24,] 564.860 564.860
#> [25,] 578.943 578.943
#> [26,] 593.046 593.046
#> [27,] 607.168 607.168
#> [28,] 621.308 621.308
#> [29,] 635.466 635.466
#> [30,] 649.641 649.641
#> [31,] 663.832 663.832
#> [32,] 678.038 678.038
#> [33,] 692.258 692.258
#> [34,] 706.493 706.493
#> [35,] 720.740 720.740
#> [36,] 735.000 735.000
#> [37,] 749.271 749.271
#> [38,] 763.552 763.552
#> [39,] 777.843 777.843
#> [40,] 792.144 792.144
#> [41,] 806.452 806.452
#> [42,] 820.768 820.768
# Get absorbance matrices
get_sample_info(example_abs, "data")
#> wavelength B1S1ExampleBlankABS B1S2ExampleTeaStdABS B1S3ExampleSampleABS
#> [1,] 800 -5.159226e-04 -0.0004515708 -6.817526e-04
#> [2,] 782 -2.866544e-04 -0.0004109280 -3.917007e-04
#> [3,] 764 -2.623151e-04 -0.0001636134 -3.390983e-04
#> [4,] 746 -2.438180e-04 -0.0001635021 -3.451140e-04
#> [5,] 728 -3.313270e-04 -0.0001709267 -3.289143e-04
#> [6,] 710 -3.320521e-04 -0.0001744385 -3.338520e-04
#> [7,] 692 -2.233652e-04 0.0001218914 -2.515936e-04
#> [8,] 674 -2.889754e-04 0.0001009222 -2.930024e-04
#> [9,] 656 -2.157825e-04 0.0002865178 -1.069766e-04
#> [10,] 638 -3.177077e-04 0.0004571561 -9.742920e-05
#> [11,] 620 -2.680614e-04 0.0007650145 7.032944e-05
#> [12,] 602 -2.610357e-04 0.0010128013 8.132194e-05
#> [13,] 584 -2.801025e-04 0.0012534304 2.479742e-04
#> [14,] 566 -3.259266e-04 0.0017388290 4.515472e-04
#> [15,] 548 -3.439060e-04 0.0022038420 6.527317e-04
#> [16,] 530 -3.227062e-04 0.0027508391 8.566349e-04
#> [17,] 512 -1.986868e-04 0.0037244471 1.330727e-03
#> [18,] 494 -3.458261e-04 0.0045452665 1.671009e-03
#> [19,] 476 -2.721901e-04 0.0054627220 2.192753e-03
#> [20,] 458 -2.250869e-04 0.0065568952 2.942494e-03
#> [21,] 440 -9.408553e-05 0.0078335564 4.096117e-03
#> [22,] 422 -2.703132e-04 0.0094138691 5.458233e-03
#> [23,] 404 -1.207382e-04 0.0126933343 7.669474e-03
#> [24,] 386 -5.420606e-05 0.0211561021 1.070529e-02
#> [25,] 368 -4.986032e-05 0.0351644121 1.479284e-02
#> [26,] 350 1.219096e-05 0.0477197511 2.029181e-02
#> [27,] 332 -2.762839e-05 0.0550182503 2.753943e-02
#> [28,] 314 3.436922e-05 0.0657055086 3.658907e-02
#> [29,] 296 2.535241e-04 0.0940748529 4.818673e-02
#> [30,] 278 2.360315e-04 0.1675592769 6.209513e-02
#> [31,] 260 4.379509e-04 0.1628521827 7.422239e-02
#> [32,] 242 7.697076e-04 0.1639415528 9.350592e-02
#> ManualExampleTeaAbsSpectraGraphs
#> [1,] 0.0002680016
#> [2,] 0.0003347789
#> [3,] 0.0003122303
#> [4,] 0.0002817973
#> [5,] 0.0004467719
#> [6,] 0.0006674719
#> [7,] 0.0008737636
#> [8,] 0.0011253695
#> [9,] 0.0012638744
#> [10,] 0.0014452115
#> [11,] 0.0018721454
#> [12,] 0.0022920237
#> [13,] 0.0028266211
#> [14,] 0.0034853210
#> [15,] 0.0043115060
#> [16,] 0.0053373430
#> [17,] 0.0067983761
#> [18,] 0.0084813808
#> [19,] 0.0101462575
#> [20,] 0.0119006147
#> [21,] 0.0139972791
#> [22,] 0.0168328685
#> [23,] 0.0222512515
#> [24,] 0.0369873264
#> [25,] 0.0619878388
#> [26,] 0.0854833096
#> [27,] 0.1012089510
#> [28,] 0.1231072027
#> [29,] 0.1784013559
#> [30,] 0.3196290397
#> [31,] 0.3045211712
#> [32,] 0.2937214087
