Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hyperSpec Arithmetic with row vector: extra data columns #149

Open
cbeleites opened this issue Jun 8, 2020 · 5 comments
Open

hyperSpec Arithmetic with row vector: extra data columns #149

cbeleites opened this issue Jun 8, 2020 · 5 comments
Assignees
Labels
Note: poll ⬆️ ⬇️ A question where everyone can vote Type: question ❔ Questions for all to consider.
Milestone

Comments

@cbeleites
Copy link
Owner

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?

@eoduniyi
Copy link
Collaborator

eoduniyi commented Jun 9, 2020

Hi @cbeleites,

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

@cbeleites
Copy link
Owner Author

@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.

@eoduniyi
Copy link
Collaborator

eoduniyi commented Jun 9, 2020

@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 

@cbeleites cbeleites added Note: poll ⬆️ ⬇️ A question where everyone can vote Type: question ❔ Questions for all to consider. and removed question ❔ labels Jun 11, 2020
@ximeg
Copy link
Collaborator

ximeg commented Jun 15, 2020

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.

@cbeleites
Copy link
Owner Author

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

@cbeleites cbeleites added this to the Version 1.0 milestone Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Note: poll ⬆️ ⬇️ A question where everyone can vote Type: question ❔ Questions for all to consider.
Projects
None yet
Development

No branches or pull requests

5 participants