Skip to contents

Read in a NanoDrop file

Usage

read_nanodrop(path, nucleotide = NULL, date = NULL, date_order = NULL)

Arguments

path

path to a NanoDrop .csv

nucleotide

An optional character vector describing the analyte detected. If NULL (the default), it will automatically try to extract one from the file path. Valid values include RNA, DNA, dsDNA, and dsRNA (or NULL).

date

An optional character vector coercible to a date object. If NULL (the default), it will automatically try to extract one from the file path. See details for detection methods.

date_order

An optional character vector to enforce an order of date to be read (if date is unspecified). Can be "ymd", "mdy", or "dmy"

Value

a nanodrop object

Details

This function expects a file that has not been tampered with from the nanodrop machine itself, aside for the name.

This function calls read.delim and guesses its encoding (usually UTF-16LE, unless it's been re-exported). It's less mysterious than reading in an apparent .csv with read.delim, and it keeps you from having to remember the encoding (which R often fails to auto-detect). When possible, it attempts to extract the nucleotide type from the path provided.

if date is NULL, the function will attempt to extract a date from the file name (not the whole file path). It will look for ymd, mdy, and dmy (in order). If it detects the first format, it will not look for the second, etc. Note how a reading taken from April 4th but written as 4_3_2021 will be misinterpreted. This error can be remedied by specifying the argument date_order

Examples

system.file("extdata", "nanodrop.csv", package = "mop") |>
  read_nanodrop()
#> <nanodrop[5]>
#> # A tibble: 18 × 24
#>    Date          Sample.Name Nucleic.Acid.ng.uL. A260.A280 A260.A230  A260  A280
#>    <chr>         <chr>                     <dbl>     <dbl>     <dbl> <dbl> <dbl>
#>  1 8/14/2021 8:… Sample 1                   420.      2.03      2.29 10.5   5.16
#>  2 8/14/2021 8:… Sample 2                   450.      2.06      2.26 11.2   5.46
#>  3 8/14/2021 8:… Sample 3                   498.      2.06      2.28 12.4   6.03
#>  4 8/14/2021 8:… Sample 4                   449.      2.05      2.25 11.2   5.48
#>  5 8/14/2021 8:… Sample 5                   474.      2.03      2.29 11.9   5.85
#>  6 8/14/2021 8:… Sample 6                   543.      2.00      2.17 13.6   6.80
#>  7 8/14/2021 8:… Sample 7                   483.      2.07      2.24 12.1   5.84
#>  8 8/14/2021 8:… Sample 8                   588.      2.07      1.97 14.7   7.08
#>  9 8/14/2021 8:… Sample 9                   490.      2.07      2.25 12.2   5.91
#> 10 8/14/2021 8:… Sample 10                  256.      2.03      2.27  6.40  3.15
#> 11 8/14/2021 8:… Sample 11                  225.      2.03      2.27  5.62  2.77
#> 12 8/14/2021 8:… Sample 12                  429.      2.06      2.26 10.7   5.22
#> 13 8/14/2021 8:… Sample 13                  216.      2.02      2.27  5.39  2.66
#> 14 8/14/2021 8:… Sample 14                  218.      2.03      2.29  5.44  2.68
#> 15 8/14/2021 8:… Sample 15                  206.      2.03      2.24  5.15  2.54
#> 16 8/14/2021 8:… Sample 16                  426.      2.07      2.25 10.7   5.15
#> 17 8/14/2021 8:… Sample 17                  389.      2.06      2.28  9.74  4.73
#> 18 8/14/2021 8:… Sample 18                  560.      2.04      2.19 14.0   6.88
#> # ℹ 17 more variables: Nucleic.Acid.Factor <dbl>,
#> #   Baseline.Correction..nm. <int>, Baseline.Absorbance <dbl>,
#> #   Corrected..ng.uL. <lgl>, Corrected..CV <lgl>, Impurity.1 <lgl>,
#> #   Impurity.1.A260 <lgl>, Impurity.1..CV <lgl>, Impurity.1.mM <lgl>,
#> #   Impurity.2 <lgl>, Impurity.2.A260 <lgl>, Impurity.2..CV <lgl>,
#> #   Impurity.2.mM <lgl>, Impurity.3 <lgl>, Impurity.3.A260 <lgl>,
#> #   Impurity.3..CV <lgl>, Impurity.3.mM <lgl>
#> # Nucelotide: NA 
#> # Is tidy: FALSE 
#> # Date: NA