Skip to content

hyperSpec Arithmetic with row vector: extra data columns #149

Open

Description

@cbeleites

here's the current behavior:

> chondro - chondro[1,]
hyperSpec object
   875 spectra
   8 data columns
   300 data points / spectrum
wavelength: Delta * tilde(nu)/cm^-1 [numeric] 602 606 ... 1798 
data:  (875 rows x 8 columns)
   1. y: y [numeric] -4.77 -4.77 ... 19.23 
   2. x: x [numeric] -11.55 -10.55 ... 22.45 
   3. filename: filename [character] rawdata/chondro.txt rawdata/chondro.txt ... rawdata/chondro.txt 
   4. clusters: clusters [factor] matrix matrix ... lacuna + NA
   5. spc: I / a.u. [matrix300] 0.000000 -1.364222 ... -117.3327 
   6. y.y: y [numeric] -4.77 -4.77 ... -4.77 
   7. x.y: x [numeric] -11.55 -11.55 ... -11.55 
   8. clusters.y: clusters [factor] matrix matrix ... matrix 

Note the "duplicated" columns. These are not exactly duplicated, but give the one value of the row vector:

> head(chondro - chondro[1,])$..
      y      x            filename clusters   y.y    x.y clusters.y
1 -4.77 -11.55 rawdata/chondro.txt   matrix -4.77 -11.55     matrix
2 -4.77 -10.55 rawdata/chondro.txt   matrix -4.77 -11.55     matrix
3 -4.77  -9.55 rawdata/chondro.txt   matrix -4.77 -11.55     matrix
4 -4.77  -8.55 rawdata/chondro.txt   matrix -4.77 -11.55     matrix
5 -4.77  -7.55 rawdata/chondro.txt   matrix -4.77 -11.55     matrix
6 -4.77  -6.55 rawdata/chondro.txt   matrix -4.77 -11.55     matrix

So the behavior is strictly logical - but this may get annoying.

Question: should we drop columns of a row vector that correspond (same name and label) to columns in the hyperSpec object?

Activity

  1. eoduniyi commented on Jun 9, 2020

    @eoduniyi
    Collaborator

    Hi @cbeleites,

    I'm not sure why we wouldn't drop the duplicate columns?

  2. cbeleites commented on Jun 9, 2020

    @cbeleites
    OwnerAuthor

    @eoduniyi They are not exactly duplicates: the 2nd version contains the same value for all rows, since it was originally the first row only and the values are copied.

  3. eoduniyi commented on Jun 9, 2020

    @eoduniyi
    Collaborator

    @eoduniyi They are not exactly duplicates: the 2nd version contains the same value for all rows, since it was originally the first row only and the values are copied.

    Right, well it seems to make sense for chondro - chondro[1, ] to remove the first row in the original hyperSpec object and get rid of the "duplicates":

    chondro$y.y <- NULL 
    chondro$x.y <- NULL 
  4. added
    Note: poll ⬆️ ⬇️
    Type: question ❔
    and removed on Jun 11, 2020
  5. ximeg commented on Jun 15, 2020

    @ximeg
    Collaborator

    chondro - chondro[1,] subtracts one spectrum from all other spectra. I, as a user, would be very much surprised if this operation changes anything else apart of the $spc matrix. So I don't find this behavior logical.

  6. cbeleites commented on Jun 15, 2020

    @cbeleites
    OwnerAuthor

    @ximeg which this? dropping columns from y or merging them into the result?

  7. added this to the Version 1.0 milestone on Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Note: poll ⬆️ ⬇️Type: question ❔

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions