diff --git a/NAMESPACE b/NAMESPACE index e7ed862..5367b7d 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,18 +1,18 @@ # Generated by roxygen2: do not edit by hand -export(convert_tocsv) -export(get_metadata) -export(get_spec) -export(parse_abs) -export(parse_generic) -export(parse_jaz) -export(parse_jazirrad) -export(parse_jdx) -export(parse_procspec) -export(parse_roh) -export(parse_trm) -export(parse_trt) -export(parse_ttt) +export(lr_convert_tocsv) +export(lr_get_metadata) +export(lr_get_spec) +export(lr_parse_abs) +export(lr_parse_generic) +export(lr_parse_jaz) +export(lr_parse_jazirrad) +export(lr_parse_jdx) +export(lr_parse_procspec) +export(lr_parse_roh) +export(lr_parse_trm) +export(lr_parse_trt) +export(lr_parse_ttt) importFrom(pbmcapply,pbmclapply) importFrom(stats,approx) importFrom(stats,setNames) diff --git a/R/convert_tocsv.R b/R/convert_tocsv.R index 1d52dc1..962a877 100644 --- a/R/convert_tocsv.R +++ b/R/convert_tocsv.R @@ -3,7 +3,7 @@ #' @param overwrite logical. Should the function overwrite existing files with #' the same name? (defaults to `FALSE`). #' -#' @inheritParams get_spec +#' @inheritParams lr_get_spec #' #' @return Convert input files to csv and invisibly return the list of created #' file paths @@ -11,14 +11,14 @@ #' @section Warning: #' #' This step loses all metadata associated to the spectra. This metadata is -#' critical to ensure reproducibility. We recommended you use [get_metadata()] -#' to extract this information from your raw data +#' critical to ensure reproducibility. We recommended you use +#' [lr_get_metadata()] to extract this information from your raw data. #' #' @importFrom tools file_path_sans_ext #' @importFrom utils write.csv #' #' @export -convert_tocsv <- function(where = getwd(), ext = "txt", decimal = ".", +lr_convert_tocsv <- function(where = getwd(), ext = "txt", decimal = ".", sep = NULL, subdir = FALSE, cores = getOption("mc.cores", 2L), ignore.case = TRUE, overwrite = FALSE) { diff --git a/R/dispatch_parser.R b/R/dispatch_parser.R index d77f263..a870396 100644 --- a/R/dispatch_parser.R +++ b/R/dispatch_parser.R @@ -6,16 +6,16 @@ dispatch_parser <- function(filename, decimal = ".", sep = NULL) { switch( tolower(file_ext(filename)), - procspec = parse_procspec(filename), - abs = parse_abs(filename), - roh = parse_roh(filename), - trm = parse_trm(filename), - trt = parse_trt(filename), - ttt = parse_ttt(filename), - jdx = parse_jdx(filename), - jaz = parse_jaz(filename), - jazirrad = parse_jazirrad(filename), - parse_generic(filename, decimal = decimal, sep = sep) + procspec = lr_parse_procspec(filename), + abs = lr_parse_abs(filename), + roh = lr_parse_roh(filename), + trm = lr_parse_trm(filename), + trt = lr_parse_trt(filename), + ttt = lr_parse_ttt(filename), + jdx = lr_parse_jdx(filename), + jaz = lr_parse_jaz(filename), + jazirrad = lr_parse_jazirrad(filename), + lr_parse_generic(filename, decimal = decimal, sep = sep) ) } diff --git a/R/get_metadata.R b/R/get_metadata.R index 403fe32..b8fb754 100644 --- a/R/get_metadata.R +++ b/R/get_metadata.R @@ -2,7 +2,7 @@ #' #' Finds and imports metadata from spectra files in a given location. #' -#' @inheritParams get_spec +#' @inheritParams lr_get_spec #' #' @export #' @@ -34,10 +34,10 @@ #' Animal Behaviour. 2015 Aug 1;106:51–7 (\doi{10.1016/j.anbehav.2015.05.007}). #' #' @examples -#' get_metadata(system.file("testdata", package = "lightr"), ext = "ProcSpec", -#' subdir = TRUE) +#' lr_get_metadata(system.file("testdata", package = "lightr"), +#' ext = "ProcSpec", subdir = TRUE) -get_metadata <- function(where = getwd(), ext = "ProcSpec", sep = NULL, +lr_get_metadata <- function(where = getwd(), ext = "ProcSpec", sep = NULL, subdir = FALSE, subdir.names = FALSE, cores = getOption("mc.cores", 2L), ignore.case = TRUE) { diff --git a/R/get_spec.R b/R/get_spec.R index afc6b4e..2a61748 100644 --- a/R/get_spec.R +++ b/R/get_spec.R @@ -3,7 +3,7 @@ #' Finds and imports reflectance/transmittance/absorbance data from spectra #' files in a given location. #' -#' @inheritParams parse_generic +#' @inheritParams lr_parse_generic #' #' @param where Folder in which files are located (defaults to current working #' directory). @@ -31,9 +31,9 @@ #' @importFrom stats approx #' #' @examples -#' get_spec(system.file("testdata", package = "lightr"), lim = c(400, 900)) +#' lr_get_spec(system.file("testdata", package = "lightr"), lim = c(400, 900)) #' -get_spec <- function(where = getwd(), ext = "txt", lim = c(300, 700), +lr_get_spec <- function(where = getwd(), ext = "txt", lim = c(300, 700), decimal = ".", sep = NULL, subdir = FALSE, subdir.names = FALSE, cores = getOption("mc.cores", 2L), ignore.case = TRUE) { diff --git a/R/parse_avantes_binary.R b/R/parse_avantes_binary.R index fecc91c..2105dd0 100644 --- a/R/parse_avantes_binary.R +++ b/R/parse_avantes_binary.R @@ -2,19 +2,21 @@ #' #' Parse Avantes binary file. #' -#' @inheritParams parse_generic +#' @inheritParams lr_parse_generic #' -#' @inherit parse_generic return +#' @inherit lr_parse_generic return #' #' @importFrom stats setNames #' #' @examples -#' parse_trm(system.file("testdata", "avantes_trans.TRM", package = "lightr")) -#' parse_roh(system.file("testdata", "avantes_reflect.ROH", package = "lightr")) +#' lr_parse_trm(system.file("testdata", "avantes_trans.TRM", +#' package = "lightr")) +#' lr_parse_roh(system.file("testdata", "avantes_reflect.ROH", +#' package = "lightr")) #' #' @export #' -parse_trm <- function(filename) { +lr_parse_trm <- function(filename) { # Translation of the matlab script from: # Copyright: (cc-by) Kotya Karapetyan, 2011. # kotya.karapetyan@gmail.com @@ -108,14 +110,14 @@ parse_trm <- function(filename) { return(list(data, metadata)) } -#' @rdname parse_trm +#' @rdname lr_parse_trm #' #' @export #' -parse_abs <- parse_trm +lr_parse_abs <- lr_parse_trm -#' @rdname parse_trm +#' @rdname lr_parse_trm #' #' @export #' -parse_roh <- parse_trm +lr_parse_roh <- lr_parse_trm diff --git a/R/parse_avantes_converted.R b/R/parse_avantes_converted.R index 92755c0..2807064 100644 --- a/R/parse_avantes_converted.R +++ b/R/parse_avantes_converted.R @@ -3,17 +3,19 @@ #' Parse Avantes converted file. #' #' -#' @inheritParams parse_generic +#' @inheritParams lr_parse_generic #' -#' @inherit parse_generic return +#' @inherit lr_parse_generic return #' #' @examples -#' parse_ttt(system.file("testdata", "avantes_export.ttt", package = "lightr")) -#' parse_trt(system.file("testdata", "avantes_export2.trt", package = "lightr")) +#' lr_parse_ttt(system.file("testdata", "avantes_export.ttt", +#' package = "lightr")) +#' lr_parse_trt(system.file("testdata", "avantes_export2.trt", +#' package = "lightr")) #' #' @export #' -parse_ttt <- function(filename) { +lr_parse_ttt <- function(filename) { # FIXME: grep to find appropriate lines instead of relying on fixed indices @@ -67,8 +69,8 @@ parse_ttt <- function(filename) { } -#' @rdname parse_ttt +#' @rdname lr_parse_ttt #' #' @export #' -parse_trt <- parse_ttt +lr_parse_trt <- lr_parse_ttt diff --git a/R/parse_generic.R b/R/parse_generic.R index 54c52f2..e9f87d7 100644 --- a/R/parse_generic.R +++ b/R/parse_generic.R @@ -12,14 +12,15 @@ #' * a list with metadata including #' #' @examples -#' parse_generic(system.file("testdata", "spec.csv", package = "lightr"), -#' sep = ",") -#' parse_generic(system.file("testdata", "CRAIC_export.txt", package = "lightr")) +#' lr_parse_generic(system.file("testdata", "spec.csv", package = "lightr"), +#' sep = ",") +#' lr_parse_generic(system.file("testdata", "CRAIC_export.txt", +#' package = "lightr")) #' #' @export #' -parse_generic <- function(filename, decimal = ".", sep = NULL) { +lr_parse_generic <- function(filename, decimal = ".", sep = NULL) { seps <- paste0(c("[[:blank:]]", sep), collapse = "|\\") diff --git a/R/parse_jdx.R b/R/parse_jdx.R index 94b6572..8dc9fc0 100644 --- a/R/parse_jdx.R +++ b/R/parse_jdx.R @@ -2,20 +2,20 @@ #' #' Parse OceanOptics JCAMP-DX (.jdx) file. #' -#' @inheritParams parse_generic +#' @inheritParams lr_parse_generic #' -#' @inherit parse_generic return +#' @inherit lr_parse_generic return #' #' @references McDonald RS, Wilks PA. JCAMP-DX: A Standard Form for Exchange of #' Infrared Spectra in Computer Readable Form. Applied Spectroscopy. #' 1988;42(1):151‑62. #' #' @examples -#' parse_jdx(system.file("testdata", "OceanOptics.jdx", package = "lightr")) +#' lr_parse_jdx(system.file("testdata", "OceanOptics.jdx", package = "lightr")) #' #' @export #' -parse_jdx <- function(filename) { +lr_parse_jdx <- function(filename) { content <- readLines(filename) author <- grep("^##OWNER=", content, value = TRUE) author <- gsub("^##OWNER= ", "", author)[1] diff --git a/R/parse_oceanoptics_converted.R b/R/parse_oceanoptics_converted.R index 17e010c..7efa15c 100644 --- a/R/parse_oceanoptics_converted.R +++ b/R/parse_oceanoptics_converted.R @@ -2,17 +2,18 @@ #' #' Parse OceanOptics converted file. #' -#' @inheritParams parse_generic +#' @inheritParams lr_parse_generic #' -#' @inherit parse_generic return +#' @inherit lr_parse_generic return #' #' @examples -#' parse_jaz(system.file("testdata", "jazspec.jaz", package = "lightr")) -#' parse_jazirrad(system.file("testdata", "irrad.JazIrrad", package = "lightr")) +#' lr_parse_jaz(system.file("testdata", "jazspec.jaz", package = "lightr")) +#' lr_parse_jazirrad(system.file("testdata", "irrad.JazIrrad", +#' package = "lightr")) #' #' @export #' -parse_jaz <- function(filename) { +lr_parse_jaz <- function(filename) { # METADATA @@ -104,8 +105,8 @@ parse_jaz <- function(filename) { return(list(data.frame(data_final), metadata)) } -#' @rdname parse_jaz +#' @rdname lr_parse_jaz #' #' @export #' -parse_jazirrad <- parse_jaz +lr_parse_jazirrad <- lr_parse_jaz diff --git a/R/parse_procspec.R b/R/parse_procspec.R index 5246474..3b5491a 100644 --- a/R/parse_procspec.R +++ b/R/parse_procspec.R @@ -2,21 +2,22 @@ #' #' Parse OceanOptics ProcSpec file. #' -#' @inheritParams parse_generic +#' @inheritParams lr_parse_generic #' -#' @inherit parse_generic return +#' @inherit lr_parse_generic return #' #' @importFrom xml2 read_xml xml_find_all xml_find_first xml_text #' #' @references #' #' @examples -#' parse_procspec(system.file("testdata", "procspec_files", -#' "OceanOptics_Linux.ProcSpec", package = "lightr")) +#' lr_parse_procspec(system.file("testdata", "procspec_files", +#' "OceanOptics_Linux.ProcSpec", +#' package = "lightr")) #' #' @export #' -parse_procspec <- function(filename) { +lr_parse_procspec <- function(filename) { # We let R find the suitable tmp folder to extract files tmp <- tempdir() on.exit(unlink(tmp)) diff --git a/README.md b/README.md index 702d38d..2419002 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ functions: ```r # Get a data.frame containing all useful metadata from spectra in a folder -get_metadata(where = "inst/testdata", ext = "ProcSpec") +lr_get_metadata(where = "inst/testdata", ext = "ProcSpec") ``` and @@ -45,21 +45,21 @@ and ```r # Get a single dataframe where the first column contains the wavelengths and # the next columns contain a spectra each (pavo's rspec class) -get_spec(where = "inst/testdata", ext = "ProcSpec") +lr_get_spec(where = "inst/testdata", ext = "ProcSpec") ``` -`get_spec()` returns a dataframe that is compatible with [`pavo`] custom S3 +`lr_get_spec()` returns a dataframe that is compatible with [`pavo`] custom S3 class (`rspec`) and can be used for further analyses using colour vision models. -All supported file formats can also be parsed using the `parse_$extension()` +All supported file formats can also be parsed using the `lr_parse_$extension()` function where `$extension` is the lowercase extension of your file. This family of functions return a list where the first element is the data dataframe and the second element is a vector with relevant metadata. Only exceptions are `.txt` and `.Transmission` files because those extensions are too generic. Users will need to figure out which parser is appropriate in -this case. `get_metadata()` and `get_spec()` automatically try generic parsers -in this case. +this case. `lr_get_metadata()` and `lr_get_spec()` automatically try generic +parsers in this case. Alternatively, you may simply want to convert your spectra in a readable standard format and carry on with your analysis with another software. @@ -69,7 +69,7 @@ In this case, you can run: ```r # Convert every single ProcSpec file to a csv file with the same name and # location -convert_tocsv(where = "inst/testdata", ext = "ProcSpec") +lr_convert_tocsv(where = "inst/testdata", ext = "ProcSpec") ``` ## ✔ Supported file formats @@ -78,43 +78,43 @@ This package is still under development but currently supports: ### [OceanOptics](https://oceanoptics.com/) - | Extension | Parser | - |:---------------|:-------------------| - | `jdx` | `parse_jdx()` | - | `ProcSpec` | `parse_procspec()` | - | `jaz` | `parse_jaz()` | - | `jazirrad` | `parse_jazirrad()` | - | `Transmission` | `parse_jaz()` | - | `txt` | `parse_jaz()` | + | Extension | Parser | + |:---------------|:----------------------| + | `jdx` | `lr_parse_jdx()` | + | `ProcSpec` | `lr_parse_procspec()` | + | `jaz` | `lr_parse_jaz()` | + | `jazirrad` | `lr_parse_jazirrad()` | + | `Transmission` | `lr_parse_jaz()` | + | `txt` | `lr_parse_jaz()` | ### [Avantes](https://www.avantes.com/) - | Extension | Parser | - |:---------------|:-------------------| - | `ABS` | `parse_abs()` | - | `ROH` | `parse_roh()` | - | `TRM` | `parse_trm()` | - | `trt` | `parse_trt()` | - | `ttt` | `parse_ttt()` | - | `txt` | `parse_generic()` | + | Extension | Parser | + |:---------------|:----------------------| + | `ABS` | `lr_parse_abs()` | + | `ROH` | `lr_parse_roh()` | + | `TRM` | `lr_parse_trm()` | + | `trt` | `lr_parse_trt()` | + | `ttt` | `lr_parse_ttt()` | + | `txt` | `lr_parse_generic()` | ### [CRAIC](http://www.microspectra.com/) - | Extension | Parser | - |:----------|:------------------| - | `txt` | `parse_generic()` | + | Extension | Parser | + |:----------|:---------------------| + | `txt` | `lr_parse_generic()` | ### Others - | Extension | Parser | - |:----------|:---------------------------| - | `csv` | `parse_generic(sep = ",")` | - | `dpt` | `parse_generic(sep = ",")` | + | Extension | Parser | + |:----------|:------------------------------| + | `csv` | `lr_parse_generic(sep = ",")` | + | `dpt` | `lr_parse_generic(sep = ",")` | ### Others -As a fallback, you should always try `parse_generic()` which offers a flexible -and general algorithm that manages to extract data from most files. +As a fallback, you should always try `lr_parse_generic()` which offers a +flexible and general algorithm that manages to extract data from most files. If you can't find the best parser for your specific file or if you believe you are using an unsupported format, please @@ -123,7 +123,7 @@ are using an unsupported format, please ## 🌐 Similar projects * `lightr` itself contains some code that has been initially forked from - [`pavo`], namely the `get_spec()` function. The code has since then been + [`pavo`], namely the `lr_get_spec()` function. The code has since then been refactored and optimised for speed. [`pavo`] differs from `lightr` in its focus and core functionalities. The main strength of [`pavo`] is the comprehensive and user-friendly set of functions to analyse spectral data diff --git a/man/convert_tocsv.Rd b/man/lr_convert_tocsv.Rd similarity index 83% rename from man/convert_tocsv.Rd rename to man/lr_convert_tocsv.Rd index f99d726..c628cc7 100644 --- a/man/convert_tocsv.Rd +++ b/man/lr_convert_tocsv.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/convert_tocsv.R -\name{convert_tocsv} -\alias{convert_tocsv} +\name{lr_convert_tocsv} +\alias{lr_convert_tocsv} \title{Convert spectral data files to csv files} \usage{ -convert_tocsv(where = getwd(), ext = "txt", decimal = ".", +lr_convert_tocsv(where = getwd(), ext = "txt", decimal = ".", sep = NULL, subdir = FALSE, cores = getOption("mc.cores", 2L), ignore.case = TRUE, overwrite = FALSE) } @@ -44,7 +44,7 @@ Convert spectral data files to csv files This step loses all metadata associated to the spectra. This metadata is -critical to ensure reproducibility. We recommended you use \code{\link[=get_metadata]{get_metadata()}} -to extract this information from your raw data +critical to ensure reproducibility. We recommended you use +\code{\link[=lr_get_metadata]{lr_get_metadata()}} to extract this information from your raw data. } diff --git a/man/get_metadata.Rd b/man/lr_get_metadata.Rd similarity index 91% rename from man/get_metadata.Rd rename to man/lr_get_metadata.Rd index 7e31dc9..d66c30a 100644 --- a/man/get_metadata.Rd +++ b/man/lr_get_metadata.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/get_metadata.R -\name{get_metadata} -\alias{get_metadata} +\name{lr_get_metadata} +\alias{lr_get_metadata} \title{Extract metadata from spectra files} \usage{ -get_metadata(where = getwd(), ext = "ProcSpec", sep = NULL, +lr_get_metadata(where = getwd(), ext = "ProcSpec", sep = NULL, subdir = FALSE, subdir.names = FALSE, cores = getOption("mc.cores", 2L), ignore.case = TRUE) } @@ -59,8 +59,8 @@ normalised data may be inaccurate otherwise. } \examples{ -get_metadata(system.file("testdata", package = "lightr"), ext = "ProcSpec", - subdir = TRUE) +lr_get_metadata(system.file("testdata", package = "lightr"), + ext = "ProcSpec", subdir = TRUE) } \references{ White TE, Dalrymple RL, Noble DWA, O'Hanlon JC, Zurek DB, diff --git a/man/get_spec.Rd b/man/lr_get_spec.Rd similarity index 90% rename from man/get_spec.Rd rename to man/lr_get_spec.Rd index 336d277..3c417e8 100644 --- a/man/get_spec.Rd +++ b/man/lr_get_spec.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/get_spec.R -\name{get_spec} -\alias{get_spec} +\name{lr_get_spec} +\alias{lr_get_spec} \title{Extract spectral data from spectra files} \usage{ -get_spec(where = getwd(), ext = "txt", lim = c(300, 700), +lr_get_spec(where = getwd(), ext = "txt", lim = c(300, 700), decimal = ".", sep = NULL, subdir = FALSE, subdir.names = FALSE, cores = getOption("mc.cores", 2L), ignore.case = TRUE) } @@ -46,6 +46,6 @@ Finds and imports reflectance/transmittance/absorbance data from spectra files in a given location. } \examples{ -get_spec(system.file("testdata", package = "lightr"), lim = c(400, 900)) +lr_get_spec(system.file("testdata", package = "lightr"), lim = c(400, 900)) } diff --git a/man/parse_generic.Rd b/man/lr_parse_generic.Rd similarity index 69% rename from man/parse_generic.Rd rename to man/lr_parse_generic.Rd index f158782..7458bfe 100644 --- a/man/parse_generic.Rd +++ b/man/lr_parse_generic.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/parse_generic.R -\name{parse_generic} -\alias{parse_generic} +\name{lr_parse_generic} +\alias{lr_parse_generic} \title{Generic function to parse spectra files that don't have a specific parser} \usage{ -parse_generic(filename, decimal = ".", sep = NULL) +lr_parse_generic(filename, decimal = ".", sep = NULL) } \arguments{ \item{filename}{Path of the file to parse} @@ -27,8 +27,9 @@ in that order Generic function to parse spectra files that don't have a specific parser } \examples{ -parse_generic(system.file("testdata", "spec.csv", package = "lightr"), - sep = ",") -parse_generic(system.file("testdata", "CRAIC_export.txt", package = "lightr")) +lr_parse_generic(system.file("testdata", "spec.csv", package = "lightr"), + sep = ",") +lr_parse_generic(system.file("testdata", "CRAIC_export.txt", + package = "lightr")) } diff --git a/man/parse_jaz.Rd b/man/lr_parse_jaz.Rd similarity index 62% rename from man/parse_jaz.Rd rename to man/lr_parse_jaz.Rd index f7fc1c0..6d7a387 100644 --- a/man/parse_jaz.Rd +++ b/man/lr_parse_jaz.Rd @@ -1,13 +1,13 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/parse_oceanoptics_converted.R -\name{parse_jaz} -\alias{parse_jaz} -\alias{parse_jazirrad} +\name{lr_parse_jaz} +\alias{lr_parse_jaz} +\alias{lr_parse_jazirrad} \title{Parse OceanOptics converted file} \usage{ -parse_jaz(filename) +lr_parse_jaz(filename) -parse_jazirrad(filename) +lr_parse_jazirrad(filename) } \arguments{ \item{filename}{Path of the file to parse} @@ -24,7 +24,8 @@ in that order Parse OceanOptics converted file. \url{https://oceanoptics.com/} } \examples{ -parse_jaz(system.file("testdata", "jazspec.jaz", package = "lightr")) -parse_jazirrad(system.file("testdata", "irrad.JazIrrad", package = "lightr")) +lr_parse_jaz(system.file("testdata", "jazspec.jaz", package = "lightr")) +lr_parse_jazirrad(system.file("testdata", "irrad.JazIrrad", + package = "lightr")) } diff --git a/man/parse_jdx.Rd b/man/lr_parse_jdx.Rd similarity index 82% rename from man/parse_jdx.Rd rename to man/lr_parse_jdx.Rd index bcb7c55..786e8b8 100644 --- a/man/parse_jdx.Rd +++ b/man/lr_parse_jdx.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/parse_jdx.R -\name{parse_jdx} -\alias{parse_jdx} +\name{lr_parse_jdx} +\alias{lr_parse_jdx} \title{Parse OceanOptics JCAMP-DX (.jdx) file} \usage{ -parse_jdx(filename) +lr_parse_jdx(filename) } \arguments{ \item{filename}{Path of the file to parse} @@ -21,7 +21,7 @@ in that order Parse OceanOptics JCAMP-DX (.jdx) file. \url{https://oceanoptics.com/} } \examples{ -parse_jdx(system.file("testdata", "OceanOptics.jdx", package = "lightr")) +lr_parse_jdx(system.file("testdata", "OceanOptics.jdx", package = "lightr")) } \references{ diff --git a/man/parse_procspec.Rd b/man/lr_parse_procspec.Rd similarity index 69% rename from man/parse_procspec.Rd rename to man/lr_parse_procspec.Rd index c8a0595..3d67c15 100644 --- a/man/parse_procspec.Rd +++ b/man/lr_parse_procspec.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/parse_procspec.R -\name{parse_procspec} -\alias{parse_procspec} +\name{lr_parse_procspec} +\alias{lr_parse_procspec} \title{Parse OceanOptics ProcSpec file} \usage{ -parse_procspec(filename) +lr_parse_procspec(filename) } \arguments{ \item{filename}{Path of the file to parse} @@ -21,8 +21,9 @@ in that order Parse OceanOptics ProcSpec file. \url{https://oceanoptics.com/} } \examples{ -parse_procspec(system.file("testdata", "procspec_files", - "OceanOptics_Linux.ProcSpec", package = "lightr")) +lr_parse_procspec(system.file("testdata", "procspec_files", + "OceanOptics_Linux.ProcSpec", + package = "lightr")) } \references{ diff --git a/man/parse_trm.Rd b/man/lr_parse_trm.Rd similarity index 57% rename from man/parse_trm.Rd rename to man/lr_parse_trm.Rd index c7f7adb..dca2132 100644 --- a/man/parse_trm.Rd +++ b/man/lr_parse_trm.Rd @@ -1,16 +1,16 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/parse_avantes_binary.R -\name{parse_trm} -\alias{parse_trm} -\alias{parse_abs} -\alias{parse_roh} +\name{lr_parse_trm} +\alias{lr_parse_trm} +\alias{lr_parse_abs} +\alias{lr_parse_roh} \title{Parse Avantes binary file} \usage{ -parse_trm(filename) +lr_parse_trm(filename) -parse_abs(filename) +lr_parse_abs(filename) -parse_roh(filename) +lr_parse_roh(filename) } \arguments{ \item{filename}{Path of the file to parse} @@ -27,7 +27,9 @@ in that order Parse Avantes binary file. \url{https://www.avantes.com/products/spectrometers} } \examples{ -parse_trm(system.file("testdata", "avantes_trans.TRM", package = "lightr")) -parse_roh(system.file("testdata", "avantes_reflect.ROH", package = "lightr")) +lr_parse_trm(system.file("testdata", "avantes_trans.TRM", + package = "lightr")) +lr_parse_roh(system.file("testdata", "avantes_reflect.ROH", + package = "lightr")) } diff --git a/man/parse_ttt.Rd b/man/lr_parse_ttt.Rd similarity index 60% rename from man/parse_ttt.Rd rename to man/lr_parse_ttt.Rd index 0e78211..416201a 100644 --- a/man/parse_ttt.Rd +++ b/man/lr_parse_ttt.Rd @@ -1,13 +1,13 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/parse_avantes_converted.R -\name{parse_ttt} -\alias{parse_ttt} -\alias{parse_trt} +\name{lr_parse_ttt} +\alias{lr_parse_ttt} +\alias{lr_parse_trt} \title{Parse Avantes converted file} \usage{ -parse_ttt(filename) +lr_parse_ttt(filename) -parse_trt(filename) +lr_parse_trt(filename) } \arguments{ \item{filename}{Path of the file to parse} @@ -25,7 +25,9 @@ Parse Avantes converted file. \url{https://www.avantes.com/products/spectrometers} } \examples{ -parse_ttt(system.file("testdata", "avantes_export.ttt", package = "lightr")) -parse_trt(system.file("testdata", "avantes_export2.trt", package = "lightr")) +lr_parse_ttt(system.file("testdata", "avantes_export.ttt", + package = "lightr")) +lr_parse_trt(system.file("testdata", "avantes_export2.trt", + package = "lightr")) } diff --git a/tests/testthat/compare_official.R b/tests/testthat/compare_official.R index 9f8f72f..1a6a61d 100644 --- a/tests/testthat/compare_official.R +++ b/tests/testthat/compare_official.R @@ -1,7 +1,7 @@ test_that("compare procspec/spectrasuite", { - specs <- get_spec(test.file("puffin"), ext = "ProcSpec") - specs_spectrasuite <- get_spec(test.file("puffin"), ext = "txt") + specs <- lr_get_spec(test.file("puffin"), ext = "ProcSpec") + specs_spectrasuite <- lr_get_spec(test.file("puffin"), ext = "txt") expect_equal(specs, specs_spectrasuite, tol = 1e-4) }) diff --git a/tests/testthat/compare_photobiologyInOut.R b/tests/testthat/compare_photobiologyInOut.R index 1ab9cfb..b01c930 100644 --- a/tests/testthat/compare_photobiologyInOut.R +++ b/tests/testthat/compare_photobiologyInOut.R @@ -8,7 +8,7 @@ test_that("pio_lightr_jaz", { out_pio[,2] <- out_pio[,2] * 100 colnames(out_pio) <- NULL - out_lightr <- parse_jazirrad(file)[[1]] + out_lightr <- lr_parse_jazirrad(file)[[1]] colnames(out_lightr) <- NULL expect_equivalent(out_pio, out_lightr[, c(1,5)]) diff --git a/tests/testthat/test_convert.R b/tests/testthat/test_convert.R index 2ea7efa..208e231 100644 --- a/tests/testthat/test_convert.R +++ b/tests/testthat/test_convert.R @@ -20,7 +20,7 @@ test_that("Convert all", { exts <- c("TRM", "ttt", "jdx", "jaz", "JazIrrad", "txt", "Transmission") - converted_files <- convert_tocsv(tdir, ext = exts) + converted_files <- lr_convert_tocsv(tdir, ext = exts) input_files <- tools::list_files_with_exts(tdir, exts) @@ -42,7 +42,7 @@ test_that("Convert all", { test_that("Convert recursive", { tdir <- tempdir() - convert_tocsv(tdir, ext = "ProcSpec", subdir = TRUE) + lr_convert_tocsv(tdir, ext = "ProcSpec", subdir = TRUE) input_files <- tools::list_files_with_exts(file.path(tdir, "procspec_files"), "ProcSpec") @@ -58,9 +58,11 @@ test_that("Convert recursive", { test_that("Convert csv", { tdir <- tempdir() - expect_warning(convert_tocsv(file.path(tdir, "csv"), ext = "csv", sep = ",")) + expect_warning(lr_convert_tocsv(file.path(tdir, "csv"), ext = "csv", + sep = ",")) - convert_tocsv(file.path(tdir, "csv"), ext = "csv", sep = ",", overwrite = TRUE) + lr_convert_tocsv(file.path(tdir, "csv"), ext = "csv", sep = ",", + overwrite = TRUE) }) @@ -86,7 +88,7 @@ test_that("Convert warn/error", { # Missing missing <- expression({ - convert_tocsv(ext = "missing") + lr_convert_tocsv(ext = "missing") }) expect_warning(eval(missing), "No files found") diff --git a/tests/testthat/test_dispatch.R b/tests/testthat/test_dispatch.R index 560a601..7047712 100644 --- a/tests/testthat/test_dispatch.R +++ b/tests/testthat/test_dispatch.R @@ -3,42 +3,42 @@ context("dispatch_parser") test_that("Fallback", { expect_equal( - parse_generic(test.file("spec.csv"), sep = ","), + lr_parse_generic(test.file("spec.csv"), sep = ","), dispatch_parser(test.file("spec.csv"), sep = ",") ) expect_equal( - parse_jdx(test.file("OceanOptics.jdx")), + lr_parse_jdx(test.file("OceanOptics.jdx")), dispatch_parser(test.file("OceanOptics.jdx")) ) expect_equal( - parse_jaz(test.file("jazspec.jaz")), + lr_parse_jaz(test.file("jazspec.jaz")), dispatch_parser(test.file("jazspec.jaz")) ) expect_equal( - parse_jazirrad(test.file("irrad.JazIrrad")), + lr_parse_jazirrad(test.file("irrad.JazIrrad")), dispatch_parser(test.file("irrad.JazIrrad")) ) expect_equal( - parse_roh(test.file("avantes_reflect.ROH")), + lr_parse_roh(test.file("avantes_reflect.ROH")), dispatch_parser(test.file("avantes_reflect.ROH")) ) expect_equal( - parse_trm(test.file("avantes_trans.TRM")), + lr_parse_trm(test.file("avantes_trans.TRM")), dispatch_parser(test.file("avantes_trans.TRM")) ) expect_equal( - parse_ttt(test.file("avantes_export.ttt")), + lr_parse_ttt(test.file("avantes_export.ttt")), dispatch_parser(test.file("avantes_export.ttt")) ) expect_equal( - parse_trt(test.file("avantes_export2.trt")), + lr_parse_trt(test.file("avantes_export2.trt")), dispatch_parser(test.file("avantes_export2.trt")) ) diff --git a/tests/testthat/test_getspec.R b/tests/testthat/test_getspec.R index 4939f68..db3ee1a 100644 --- a/tests/testthat/test_getspec.R +++ b/tests/testthat/test_getspec.R @@ -2,7 +2,7 @@ context("get_spec") test_that("get_spec all", { - res <- get_spec(test.file(), + res <- lr_get_spec(test.file(), ext = c("TRM", "ttt", "jdx", "jaz", "JazIrrad", "csv", "txt", "Transmission"), sep = ",") @@ -12,21 +12,21 @@ test_that("get_spec all", { test_that("get_spec recursive", { # Recursive - res <- get_spec(test.file(), ext = "ProcSpec", subdir = TRUE) + res <- lr_get_spec(test.file(), ext = "ProcSpec", subdir = TRUE) expect_known_value(res, "known_output/getspec_recursive.rds") }) test_that("get_spec range", { - res <- get_spec(test.file(), "ttt", lim = c(400,500)) + res <- lr_get_spec(test.file(), "ttt", lim = c(400,500)) expect_equal(nrow(res), 101) }) test_that("get_spec warn/error", { # Total fail totalfail <- expression({ - get_spec(test.file(), - ext = "fail") + lr_get_spec(test.file(), + ext = "fail") }) expect_warning(eval(totalfail), "File import failed") @@ -34,14 +34,14 @@ test_that("get_spec warn/error", { # Partial fail partialfail <- expression({ - get_spec(test.file(), - ext = c("fail", "jdx")) + lr_get_spec(test.file(), + ext = c("fail", "jdx")) }) expect_warning(eval(partialfail), "Could not import one or more") # Missing missing <- expression({ - get_spec(ext = "missing") + lr_get_spec(ext = "missing") }) expect_warning(eval(missing), "No files found") diff --git a/tests/testthat/test_metadata.R b/tests/testthat/test_metadata.R index daa22e8..c73cf47 100644 --- a/tests/testthat/test_metadata.R +++ b/tests/testthat/test_metadata.R @@ -2,7 +2,7 @@ context("get_metadata") test_that("get_metadata all", { - res <- get_metadata( + res <- lr_get_metadata( test.file(), ext = c("TRM", "ROH", "ttt", "trt", "jdx", "jaz", "JazIrrad") ) @@ -13,7 +13,7 @@ test_that("get_metadata all", { test_that("get_metadata recursive", { # Recursive - res <- get_metadata(test.file(), + res <- lr_get_metadata(test.file(), ext = "ProcSpec", subdir = TRUE) expect_known_value(res, "known_output/getmetadata_recursive.rds") }) @@ -21,7 +21,7 @@ test_that("get_metadata recursive", { test_that("get_metadata warn/error", { # Total fail totalfail <- expression({ - get_metadata(test.file(), + lr_get_metadata(test.file(), ext = "fail") }) expect_warning(eval(totalfail), "File import failed") @@ -30,14 +30,14 @@ test_that("get_metadata warn/error", { # Partial fail partialfail <- expression({ - get_metadata(test.file(), + lr_get_metadata(test.file(), ext = c("fail", "jdx")) }) expect_warning(eval(partialfail), "Could not import one or more") # Missing missing <- expression({ - get_metadata(ext = "missing") + lr_get_metadata(ext = "missing") }) expect_warning(eval(missing), "No files found") diff --git a/tests/testthat/test_multicores.R b/tests/testthat/test_multicores.R index c35029e..756ba32 100644 --- a/tests/testthat/test_multicores.R +++ b/tests/testthat/test_multicores.R @@ -4,12 +4,12 @@ test_that("Multicores", { skip_if(.Platform$OS.type != "windows") - expect_message(get_spec(system.file("testdata", package = "lightr"), - ext = "jdx", cores = 2), + expect_message(lr_get_spec(system.file("testdata", package = "lightr"), + ext = "jdx", cores = 2), '"cores" set to 1.') - expect_message(get_metadata(system.file("testdata", package = "lightr"), - ext = "jdx", cores = 2), + expect_message(lr_get_metadata(system.file("testdata", package = "lightr"), + ext = "jdx", cores = 2), '"cores" set to 1.') }) diff --git a/tests/testthat/test_parsers.R b/tests/testthat/test_parsers.R index 48169ab..b9b336c 100644 --- a/tests/testthat/test_parsers.R +++ b/tests/testthat/test_parsers.R @@ -2,62 +2,62 @@ context("parsers") test_that("OceanOptics", { - expect_length(parse_procspec(test.file("procspec_files", + expect_length(lr_parse_procspec(test.file("procspec_files", "OceanOptics_Linux.ProcSpec")), 2) - expect_length(parse_procspec(test.file("procspec_files", + expect_length(lr_parse_procspec(test.file("procspec_files", "OceanOptics_Windows.ProcSpec")), 2) - expect_length(parse_procspec(test.file("procspec_files", + expect_length(lr_parse_procspec(test.file("procspec_files", "OceanOptics_badencode.ProcSpec")), 2) - expect_length(parse_jdx(test.file("OceanOptics.jdx")), + expect_length(lr_parse_jdx(test.file("OceanOptics.jdx")), 2) - expect_length(parse_jaz(test.file("jazspec.jaz")), + expect_length(lr_parse_jaz(test.file("jazspec.jaz")), 2) - expect_length(parse_jazirrad(test.file("irrad.JazIrrad")), + expect_length(lr_parse_jazirrad(test.file("irrad.JazIrrad")), 2) - expect_length(parse_jaz(test.file("FMNH6834.00000001.Master.Transmission")), + expect_length(lr_parse_jaz(test.file("FMNH6834.00000001.Master.Transmission")), 2) - expect_length(parse_jaz(test.file("UK5.txt")), + expect_length(lr_parse_jaz(test.file("UK5.txt")), 2) }) test_that("Avantes", { - expect_length(parse_roh(test.file("avantes_reflect.ROH")), + expect_length(lr_parse_roh(test.file("avantes_reflect.ROH")), 2) - expect_length(parse_trm(test.file("avantes_trans.TRM")), + expect_length(lr_parse_trm(test.file("avantes_trans.TRM")), 2) - expect_length(parse_trm(test.file("avantes2.TRM")), + expect_length(lr_parse_trm(test.file("avantes2.TRM")), 2) - expect_length(parse_ttt(test.file("avantes_export.ttt")), + expect_length(lr_parse_ttt(test.file("avantes_export.ttt")), 2) - expect_length(parse_ttt(test.file("avantes_export_long.ttt")), + expect_length(lr_parse_ttt(test.file("avantes_export_long.ttt")), 2) - expect_length(parse_trt(test.file("avantes_export2.trt")), + expect_length(lr_parse_trt(test.file("avantes_export2.trt")), 2) }) test_that("Generic", { - expect_error(parse_generic(test.file("spec.csv")), "Parsing failed.") + expect_error(lr_parse_generic(test.file("spec.csv")), "Parsing failed.") - expect_length(parse_generic(test.file("spec.csv"), sep = ","), + expect_length(lr_parse_generic(test.file("spec.csv"), sep = ","), 2) - expect_length(parse_generic(test.file("RS-1.dpt"), sep = ","), + expect_length(lr_parse_generic(test.file("RS-1.dpt"), sep = ","), 2) }) diff --git a/vignettes/batch_import.Rmd b/vignettes/batch_import.Rmd index f7b64f6..e22c360 100644 --- a/vignettes/batch_import.Rmd +++ b/vignettes/batch_import.Rmd @@ -12,15 +12,16 @@ vignette: > `lightr` provides three main functions for patch import of spectral data and metadata: -* `get_spec()` -* `get_metadata()` -* `spec2csv()` +* `lr_get_spec()` +* `lr_get_metadata()` +* `lr_spec2csv()` Those three functions contain a loop and can directly be used to import/convert whole folders. They also allow for recursive search in the folder tree with the argument -`subdir`. In this example, the `data` that contains a subdirectory named `procspec_files`, which contains : +`subdir`. In this example, the `data` that contains a subdirectory named +`procspec_files`, which contains : ``` └──+ data @@ -34,73 +35,73 @@ They also allow for recursive search in the folder tree with the argument └── whiteref.ProcSpec ``` -We first demonstrate these features on `get_spec()` but they work in the same -way for `get_metadata()` and `spec2csv()` +We first demonstrate these features on `lr_get_spec()` but they work in the same +way for `lr_get_metadata()` and `lr_spec2csv()` ```{r} library(lightr) ``` -## Import spectral data: `get_spec()` +## Import spectral data: `lr_get_spec()` -`get_spec()` is one the core functions of `lightr`. It finds spectral data +`lr_get_spec()` is one the core functions of `lightr`. It finds spectral data files, extract the reflectance / transmittance / absorbance data and returns a `data.frame` where the first column (named `wl`) contains the wavelengths and the subsequent columns contain the spectral data, interpolated every nanometre: ```{r} -res <- get_spec(where = "data", ext = "ttt", lim = c(300, 700)) +res <- lr_get_spec(where = "data", ext = "ttt", lim = c(300, 700)) head(res) ``` -`get_spec()` also supports setting multiple file extensions at once by passing +`lr_get_spec()` also supports setting multiple file extensions at once by passing a character vector to `ext`: ```{r} -res <- get_spec(where = "data", ext = c("ttt", "trt"), lim = c(300, 700)) +res <- lr_get_spec(where = "data", ext = c("ttt", "trt"), lim = c(300, 700)) head(res) ``` -Finally, `get_spec()` can also recursively search in your folder tree with the -`subdir` argument: +Finally, `lr_get_spec()` can also recursively search in your folder tree with +the `subdir` argument: ```{r} -res <- get_spec(where = "data", ext = "procspec", lim = c(300, 700), subdir = TRUE) +res <- lr_get_spec(where = "data", ext = "procspec", lim = c(300, 700), subdir = TRUE) head(res) ``` -As you may have noticed, `get_spec()` does not care about the file extension +As you may have noticed, `lr_get_spec()` does not care about the file extension case by default. This can be changed by using the `ignore.case` switch: ```{r} -res <- get_spec(where = "data", ext = "procspec", subdir = TRUE, ignore.case = FALSE) +res <- lr_get_spec(where = "data", ext = "procspec", subdir = TRUE, ignore.case = FALSE) ``` -## Import spectral metadata: `get_metadata()` +## Import spectral metadata: `lr_get_metadata()` -`get_metadata()` extracts metadata captured by the spectrophotometer during the -recording. This metadata should be reported in your scientific articles to +`lr_get_metadata()` extracts metadata captured by the spectrophotometer during +the recording. This metadata should be reported in your scientific articles to ensure reproducibility of your measurements and ultimately of your findings. The amount of information strongly depends on the brand and model of the spectrometer. -Similarly to `get_spec()`, it can handle multiple extensions at once and perform -recursive searches: +Similarly to `lr_get_spec()`, it can handle multiple extensions at once and +perform recursive searches: ```{r} -res <- get_metadata(where = "data", ext = c("trt", "procspec"), subdir = TRUE) +res <- lr_get_metadata(where = "data", ext = c("trt", "procspec"), subdir = TRUE) head(res) ``` -## Convert spectral data to csv: `convert_tocsv()` +## Convert spectral data to csv: `lr_convert_tocsv()` -`convert_tocsv()` is designed for people that want to a machine readable version -for each individual input file, possibly allowing them to carry on with their -analysis using another programming language or software. +`lr_convert_tocsv()` is designed for people that want to a machine readable +version for each individual input file, possibly allowing them to carry on with +their analysis using another programming language or software. -It works in a very similar way to `get_spec()` and will create `csv` files with -the same file names as the input files (but a different extension). +It works in a very similar way to `lr_get_spec()` and will create `csv` files +with the same file names as the input files (but a different extension). ```{r} -convert_tocsv(where = "data", ext = "procspec", subdir = TRUE) +lr_convert_tocsv(where = "data", ext = "procspec", subdir = TRUE) ``` diff --git a/vignettes/custom_import.Rmd b/vignettes/custom_import.Rmd index f33f4c5..86e0d89 100644 --- a/vignettes/custom_import.Rmd +++ b/vignettes/custom_import.Rmd @@ -15,10 +15,10 @@ low-level individual parsers, which allow the user to code its own custom workflow. We don't recommend the use of those functions unless you absolutely have to. -Most users should use `get_spec()` and `get_metadata()` instead. +Most users should use `lr_get_spec()` and `lr_get_metadata()` instead. A common request from spectral data users is too keep their raw data, without -any interpolation. This is not possible in `get_spec()` but it parses spectra +any interpolation. This is not possible in `lr_get_spec()` but it parses spectra from many different formats and then concatenates them to output a single dataframe. For this to be possible, all spectra must be evaluated over the same wavelengths, which is not usually the case at first. So, we do need to @@ -41,14 +41,14 @@ jdx_files <- list.files("data/heliomaster", pattern = "jdx$", full.names = TRUE) ## Step 2: import individual spectra ```{r} -first_jdx <- parse_jdx(jdx_files[1])[[1]] +first_jdx <- lr_parse_jdx(jdx_files[1])[[1]] head(first_jdx) ``` -As you can see on this first file, `parse_$extension()` functions return a +As you can see on this first file, `lr_parse_$extension()` functions return a data frame with many columns. The meaning of each column is explained in full -details in `?parse_jdx`. Here, we are only interested in the first column (the -wavelengths) and the last one (the normalised spectral data). +details in `?lr_parse_jdx`. Here, we are only interested in the first column +(the wavelengths) and the last one (the normalised spectral data). ```{r} res <- first_jdx[, c("wl", "processed")] @@ -62,7 +62,7 @@ record the "processed" column: ```{r} for (i in 2:length(jdx_files)) { - next_jdx <- parse_jdx(jdx_files[i])[[1]] + next_jdx <- lr_parse_jdx(jdx_files[i])[[1]] res <- cbind(res, next_jdx[, "processed"]) } @@ -93,7 +93,7 @@ library(fs) get_uninterp <- function(path, extension) { dir_ls(path = path, glob = extension) %>% - map_dfc(function(file) dispatch_parser(file)[[1]]) %>% + map_dfc(function(file) lightr:::dispatch_parser(file)[[1]]) %>% select(wl, starts_with("processed")) } diff --git a/vignettes/renormalise.Rmd b/vignettes/renormalise.Rmd index 5a61eb6..235d53d 100644 --- a/vignettes/renormalise.Rmd +++ b/vignettes/renormalise.Rmd @@ -15,7 +15,7 @@ low-level individual parsers, which allow the user to code its own custom workflow. We don't recommend the use of those functions unless you absolutely have to. -Most users should use `get_spec()` and `get_metadata()` instead. +Most users should use `lr_get_spec()` and `lr_get_metadata()` instead. Here, we take the example of the method presented in [Gruson *et al* (2018)](https://doi.org/10.1098/rsfs.2018.0049) where @@ -29,8 +29,8 @@ normalised by a white and a dark reference with the following formula: $$\text{Processed} = \dfrac{\text{Raw} - \text{Dark}}{\text{White} - \text{Dark}}$$ For this example here, we need to normalise the raw data by a white reference -contained in another file. This can't be done with with `get_spec()` because -`get_spec()` returns reflectance spectra that have already been normalised by +contained in another file. This can't be done with with `lr_get_spec()` because +`lr_get_spec()` returns reflectance spectra that have already been normalised by the white reference contained in the same file. ```{r} @@ -42,7 +42,7 @@ library(lightr) We manually import the data using the appropriate low-level parser: ```{r} -reflect_data <- parse_procspec( +reflect_data <- lr_parse_procspec( system.file("testdata", "procspec_files", "OceanOptics_Linux.ProcSpec", package = "lightr") ) @@ -63,7 +63,7 @@ head(reflect_data[[1]]) We import that white reference in the same way: ```{r} -white_data <- parse_procspec( +white_data <- lr_parse_procspec( system.file("testdata", "procspec_files", "whiteref.ProcSpec", package = "lightr") ) diff --git a/vignettes/true_example.Rmd b/vignettes/true_example.Rmd index 12a65b5..62e4a62 100644 --- a/vignettes/true_example.Rmd +++ b/vignettes/true_example.Rmd @@ -46,8 +46,8 @@ So, let's start by comparing the `.ProcSpec` spectra imported by `lightr` and the `.txt` files produced by OceanOptics. ```{r} -raw_files <- get_spec("data/puffin", ext = "ProcSpec") -txt_files <- get_spec("data/puffin", ext = "txt") +raw_files <- lr_get_spec("data/puffin", ext = "ProcSpec") +txt_files <- lr_get_spec("data/puffin", ext = "txt") ``` We can visually inspect these two file using the dedicated S3 function