Skip to content

dput(hyperSpec object) doesn't work #68

Closed

Description

@cbeleites
dput(flu[1,,400~ 410])

gives:

new("hyperSpec", wavelength = c(405, 405.5, 406, 406.5, 407, 407.5, 408, 408.5, 409, 409.5, 410), 
    data = structure(list(spc = structure(c(27.15, 32.344666, 33.378666, 34.419333, 36.531333, 37.647666, 38.137, 
                                            39.177, 40.735666, 41.381333, 44.251333), .Dim = c(1L, 11L), .Dimnames = list(
                                              NULL, c("405", "405.5", "406", "406.5", "407", "407.5", "408", 
                                                      "408.5", "409", "409.5", "410"))), 
                          filename = "rawdata/flu1.txt", 
                          c = 0.05), row.names = 1L, class = "data.frame"), label = list(
                            .wavelength = expression(lambda/nm), spc = expression(I[fl]/"a.u."), 
                            filename = "filename", c = "c / (mg / l)"), 
    log = new("data.frame", 
              .Data = list(), names = character(0), row.names = integer(0), 
              .S3Class = "data.frame"))

Which throws an error due to trying to assign the log slot.

This prevents reprex() from working with user-supplied spectra

Activity

  1. self-assigned this
    on Dec 1, 2021
  2. added this to the 1.0 CRAN submission milestone on Dec 1, 2021
  3. GegznaV commented on Aug 7, 2022

    @GegznaV
    Member

    One of the solutions is to add a log argument to new("hyperSpec", ...), which is sued only for backward compatibility (i.e., not to break the result of dput()). In the future, this can be solved in a more systematic way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions