Reads a CSV data file downloaded from the FReD (Floral Reflectance Database) and then imports wavelengths and spectral reflectance values and flower ID.
Usage
read_FReD_csv(
file,
date = NA,
geocode = NULL,
label = NULL,
tz = NULL,
locale = readr::default_locale()
)Arguments
- file
character string
- date
a
POSIXctobject to use to set the"when.measured"attribute. IfNULL, the default, the date is extracted from the file header.- geocode
A data frame with columns
lonandlatused to set attribute"where.measured".- label
character string, but if
NULLthe value offileis used, and ifNAthe "what.measured" attribute is not set.- tz
character Time zone used for interpreting times saved in the file header.
- locale
The locale controls defaults that vary from place to place. The default locale is US-centric (like R), but you can use
localeto create your own locale that controls things like the default time zone, encoding, decimal mark, big mark, and day/month names. Those relevant should match the format of the CSV file being read.
References
http://www.reflectance.co.uk Arnold SEJ, Faruq S, Savolainen V, McOwan PW, Chittka L, 2010 FReD: The Floral Reflectance Database - A Web Portal for Analyses of Flower Colour. PLoS ONE 5(12): e14287. doi:10.1371/journal.pone.0014287
Examples
file.name <-
system.file("extdata", "FReDflowerID_157.csv",
package = "photobiologyInOut", mustWork = TRUE)
fred.spct <- read_FReD_csv(file = file.name)
fred.spct
#> Object: reflector_spct [401 x 3]
#> Wavelength range 300-700 nm, step 1 nm
#> Label: File: FReDflowerID_157.csv
#> Variables:
#> w.length: Wavelength [nm]
#> Rfr: Total spectral reflectance [/1]
#> --
#> # A tibble: 401 × 3
#> flower.id w.length Rfr
#> <dbl> <dbl> <dbl>
#> 1 157 300 0.0627
#> 2 157 301 0.0654
#> 3 157 302 0.0678
#> 4 157 303 0.0670
#> 5 157 304 0.0668
#> 6 157 305 0.0627
#> 7 157 306 0.0654
#> 8 157 307 0.0678
#> 9 157 308 0.0670
#> 10 157 309 0.0627
#> # ℹ 391 more rows
getWhatMeasured(fred.spct)
#> [1] "File: FReDflowerID_157.csv"
cat(comment(fred.spct))
#> FReD file 'FReDflowerID_157.csv' imported on 2025-10-02 21:42:52.574781 UTC
