plantphys / spectratrait

A tutorial R package for illustrating how to fit, evaluate, and report spectra-trait PLSR models. The package provides functions to enhance the base functionality of the R pls package, identify an optimal number of PLSR components, standardize model validation, and vignette examples that utilize datasets sourced from EcoSIS (ecosis.org)
GNU General Public License v3.0
11 stars 9 forks source link

Issues Found by Ken 20200814 expanded_spectra-trait_plsr_example.R #17

Closed DavidsonKen closed 3 years ago

DavidsonKen commented 4 years ago

line 117: val.pls.data<-plsr_data[!plsr_data$id %in% cal.plsr.data$id,] change to val.plsr.data<-plsr_data[!plsr_data$id %in% cal.plsr.data$id,]

line 153: object cal_hist_plot returns error. I think this is because the object cal.plsr.data which is used to make the plot is an S3 grouped object and thus qqplot doesn't know how to deal with it. I changed cal.plsr.data to a data.frame and it worked fine for the rest of the script

line 193 and 195: Error in xy.coords(x, y, setLab = FALSE) : 'x' and 'y' lengths differ. Looks like there is an additional entry "id" in the cal.plsr.data$Spectra vector which is causing the differing lengths

line 445, 449, 593, 595 and 599,: Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ. I think this is the same issue as above. The vectors "coefs" and "vips" have a length of 1902, which is 1 longer than the length of seq(Start.wave,End.wave,1). The named last entry in both of these vectors is id

serbinsh commented 4 years ago

CC @JulienLamour @neo0351

serbinsh commented 3 years ago

I think after the updates these issues will be fixed but I will have to confirm

serbinsh commented 3 years ago

@DavidsonKen can you try running again, perhaps avoid the NEON example and try

expanded_spectra-trait_reseco_leafN_plsr_example.R

or

expanded_spectra-trait_reseco_lma_plsr_example.R

When you have a chance. Make sure to merge in the latest changes on Master. Also the name of the repo changed so you may just want to reclone locally

DavidsonKen commented 3 years ago

@serbinsh ran both the above files locally. No issues found, and they run much more smoothly than before. I like the new/improved graphics as well. No edits made by me. Shall I close out this issue?

serbinsh commented 3 years ago

Thanks @DavidsonKen!! Couple of questions did you source the functions via GitHub or local? What platform, R version did you use?

Leave this open as I will likely as that you run one more time after a few more edits as a tester :)

DavidsonKen commented 3 years ago

@serbinsh helper functions were sourced locally (i.e. I copied the functions.R file to my computer). I can try again sourcing them from GitHub if you want?

I ran everything inside RStudio Version 1.2.5033, running base R version 3.6.2

Happy to continue to test through the day

DavidsonKen commented 3 years ago

Miror of what I put on slack:

@serbinsh @neo0351 updated non-neon code isn’t working for the ggplot version update.
Error in download_version_url(package, version, repos, type) : version '>= 3.3.2' is invalid for package 'ggplot2' perhaps its because 3.3.2 is the latest release? In any case, I was able to edit the code to remove the “>=” section from the argument, and my version has updated from 3.3.0 to 3.3.2. No other issues found. Sourced the functions.R from both github and a local copy, and both work fine

neo0351 commented 3 years ago

@serbinsh can we close this one?

serbinsh commented 3 years ago

I think so. closing