You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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?()
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:
Activity
cbeleites commentedon 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 ascores()function. Package pls has both, though (and so do probably a number of other packages). pls makes bothloadings()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()andscores2?()GegznaV commentedon Dec 23, 2020
I agree with @cbeleites:
GegznaV commentedon Dec 23, 2020
I also think that
as.hyperSpec()(especially methodas.hyperSpec(<matrix>)) could be rewritten in a way to incorporate the functionality ofdecomposition(). This could solve the renaming part suggested by @bryanhanson:GegznaV commentedon Aug 12, 2021
This discussion moved and reopen as:
decomposition()r-hyperspec/hyperSpec#55