
Read '.csv' File Saved by Avantes' Software for AvaSpec.
Source:R/read-avaspec-csv.r
read_avaspec_csv.Rd
Reads and parses the header of a processed data file as output by the program Avaspec and then imports wavelength and spectral irradiance values. The file header has little useful metadata information.
Usage
read_avaspec_csv(
file,
date = NULL,
geocode = NULL,
label = NULL,
tz = NULL,
locale = readr::default_locale()
)
read_avaspec_xls(
path,
date = NULL,
geocode = NULL,
label = NULL,
tz = NULL,
locale = readr::default_locale()
)
Arguments
- file
character string
- date
a
POSIXct
object 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
lon
andlat
used to set attribute"where.measured"
.- label
character string, but if
NULL
the value offile
is used, and ifNA
the "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
locale
to create your own locale that controls things like the default time zone, encoding, decimal mark, big mark, and day/month names.- path
Path to the xls/xlsx file
Examples
file.name <-
system.file("extdata", "spectrum-avaspec.csv",
package = "photobiologyInOut", mustWork = TRUE)
avaspec.spct <- read_avaspec_csv(file = file.name)
avaspec.spct
#> Object: source_spct [1,604 x 2]
#> Wavelength range 172.485-1100.222 nm, step 0.544-0.607 nm
#> Label: File: spectrum-avaspec.csv
#> Variables:
#> w.length: Wavelength [nm]
#> s.e.irrad: Spectral energy irradiance [W m-2 nm-1]
#> --
#> # A tibble: 1,604 × 2
#> w.length s.e.irrad
#> <dbl> <dbl>
#> 1 172. 9.28e-12
#> 2 173. 1.10e-11
#> 3 174. 1.04e-11
#> 4 174. 8.93e-12
#> 5 175. 9.63e-12
#> 6 176. 8.44e-12
#> 7 176. 1.04e-11
#> 8 177. 1.02e-11
#> 9 177. 1.06e-11
#> 10 178. 9.57e-12
#> # ℹ 1,594 more rows
getWhatMeasured(avaspec.spct)
#> [1] "File: spectrum-avaspec.csv"
cat(comment(avaspec.spct))
#> Avantes AvaSpec irradiance file 'spectrum-avaspec.csv' imported on 2025-03-10 15:48:17.706721 UTC
#> Filename-->,F1_G2_201505290001.IRR
#> Mode/Unit-->,Irradiance[?Watt/cm?]
#> Int.time[ms]-->,100
#> NrOfAverages-->,100
#> Smoothing-->,0
#> Wavelength[nm],1412092U1-
#> f1
#> g2
#> kesk
#> 80
#> cm
#> I