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

Rename and/or Split and/or Rework decomposition (proposal) #144

Closed
bryanhanson opened this issue May 26, 2020 · 4 comments
Closed

Rename and/or Split and/or Rework decomposition (proposal) #144

bryanhanson opened this issue May 26, 2020 · 4 comments
Labels
Priority: 2-medium Type: proposal 💡 Proposed ideas for all to consider.
Milestone

Comments

@bryanhanson
Copy link
Collaborator

In the course of investigating something else I had the occasion to study the decomposition function. This function doesn't seem to decompose anything, it takes the results of a decomposition and then can plot scores, loadings or the centering values (after converting them to a hyperSpec object). It would be clearer if this function were renamed (not sure to what at this point).

It's use might be more streamlined as well, again I don't have a well developed idea right now. However my initial idea is that the plot method accepts a 2nd argument which gives the type of plot to make. Perhaps "loadings" and "scores" could be options. If that is acceptable approach, then maybe the plot function could require and check for an object of class prcomp in those cases (and maybe other objects). Further, all the manipulations of the prcomp object could be handled in the plot function, transparently to the user. In this case most of the decomposition function would move to the plot function, or perhaps decomposition could continue but called by plot and not be exported.

Also, I see in the code that there is a commented message stating decomposition would be deprecated, to be replaced by different functions loadings and scores.

@bryanhanson bryanhanson added Type: proposal 💡 Proposed ideas for all to consider. Priority: 2-medium labels May 26, 2020
@cbeleites
Copy link
Owner

cbeleites commented May 27, 2020

  • I'd like to keep the results of decomposition() or however its successors are named independent of plotting functions: I use them for various things, and plotting is only one of the uses.

  • I'm not entirely sure whether scores-like objects should actually go into a hyperSpec object. What we need, though, are the extra data columns of the original hyperSpec object with a matrix-column that contains the scores.
    OTOH, abusing a hyperSpec object for this allows e.g. convenient plotting of scores maps, scores over depth/time and the like

  • loadings-like objects should be converted into a hyperSpec object, since they are actually very similar to spectra and have the same wavelengths.

  • stats::loadings() is not generic, and AFAIK base R does not have a scores() function. Package pls has both, though (and so do probably a number of other packages). pls makes both loadings() and scores a generic method - which we'd want as well. This means, that we'll have to check carefully how to interact with that without messing up things, and regardless whether hyperSpec is loaded after pls or the other way round.

  • The alternative would be to use a different name for the functions, e.g. loadings2hySpc() and scores2?()

@GegznaV
Copy link
Collaborator

GegznaV commented Dec 23, 2020

I agree with @cbeleites:

I'd like to keep the results of decomposition() or however its successors are named independent of plotting functions

@GegznaV
Copy link
Collaborator

GegznaV commented Dec 23, 2020

I also think that as.hyperSpec() (especially method as.hyperSpec(<matrix>)) could be rewritten in a way to incorporate the functionality of decomposition(). This could solve the renaming part suggested by @bryanhanson:

It would be clearer if this function were renamed

@GegznaV
Copy link
Collaborator

GegznaV commented Aug 12, 2021

This discussion moved and reopen as:

@GegznaV GegznaV closed this as completed Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: 2-medium Type: proposal 💡 Proposed ideas for all to consider.
Projects
None yet
Development

No branches or pull requests

3 participants