Skip to contents

Reads and parses the header of processed data CSV files as output by the virtual- or hardware-hubs and modules from Yoctopuce. Uses the comment attribute to store the metadata.

Usage

read_yoctopuce_csv(
  file,
  geocode = NULL,
  label = NULL,
  data_skip = 0,
  n_max = Inf,
  locale = readr::default_locale()
)

Arguments

file

Path to file as a character string.

geocode

A data frame with columns lon and lat used to set attribute "where.measured".

label

character string, but if NULL the value of file is used, and if NA the "what.measured" attribute is not set.

data_skip

integer Number of records (rows) to skip from the actual data block.

n_max

integer Maximum number of records to read.

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.

Value

read_yoctopuce_csv() returns a tibble::tibble object, with the number of columns dependent on the CSV file read.

Details

Yoctopuce modules are small USB connected and USB powered, but isolated, very high quality miniature data acquisition and interface modules. All modules capable of data acquisition can log measured data autonomously and these data can be locally or remotely downloaded as a CSV file. (It is also possible and very easy to access these modules from R using package 'reticulate' and the Python library provided by Yoctopuce, or to send commands and retrieve data through the built-in HTML server of the modules or dedicated hubs.)

Note

This function should be able to read data log files from any YoctoPuce USB interface module with data logging capabilities as the format is consistent among them.

Examples

  
  # We read a CSV file previously downloaded from a YoctoMeteo module.

 file.name <- 
   system.file("extdata", "yoctopuce-data.csv", 
               package = "photobiologyInOut", mustWork = TRUE)
                
 yoctopc.tb <- read_yoctopuce_csv(file = file.name)
 
 yoctopc.tb
#> # A tibble: 705 × 10
#>    ISO.time            temperature.min temperature.avg temperature.max
#>    <dttm>                        <dbl>           <dbl>           <dbl>
#>  1 2017-09-03 13:00:00            17.0            17.1            17.1
#>  2 2017-09-03 14:00:00            17.1            17.2            17.3
#>  3 2017-09-03 15:00:00            17.3            17.4            17.6
#>  4 2017-09-03 16:00:00            17.6            17.9            18.3
#>  5 2017-09-03 17:00:00            18.2            18.6            19.1
#>  6 2017-09-03 18:00:00            19.1            19.5            20.0
#>  7 2017-09-03 19:00:00            19.8            20.1            20.3
#>  8 2017-09-03 20:00:00            19.2            19.5            19.8
#>  9 2017-09-03 21:00:00            18.7            18.9            19.2
#> 10 2017-09-03 22:00:00            18.4            18.6            18.7
#> # ℹ 695 more rows
#> # ℹ 6 more variables: pressure.min <dbl>, pressure.avg <dbl>,
#> #   pressure.max <dbl>, humidity.min <dbl>, humidity.avg <dbl>,
#> #   humidity.max <dbl>
 cat(comment(yoctopc.tb))
#> Data from a YoctoPuce module. File: yoctopuce-data.csv