Skip to content

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

Closed

Description

@bryanhanson

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.

Activity

  1. added
    Type: proposal 💡
    on May 26, 2020
  2. cbeleites commented on May 27, 2020

    @cbeleites
    Owner
    • 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?()

  3. added this to the Version 1.0 milestone on Jun 15, 2020
  4. GegznaV commented on Dec 23, 2020

    @GegznaV
    Collaborator

    I agree with @cbeleites:

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

  5. GegznaV commented on Dec 23, 2020

    @GegznaV
    Collaborator

    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

  6. GegznaV commented on Aug 12, 2021

    @GegznaV
    Collaborator

    This discussion moved and reopen as:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority: 2-mediumType: proposal 💡

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions