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

Testing from the POV of unskilled user #69

Closed
regnans opened this issue Feb 12, 2021 · 12 comments
Closed

Testing from the POV of unskilled user #69

regnans opened this issue Feb 12, 2021 · 12 comments

Comments

@regnans
Copy link
Contributor

regnans commented Feb 12, 2021

I'm trying to be "that reviewer" that has no idea what they are doing with GitHub or R. (not that far from the truth).

Running spectra-trait_reseco_lma_plsr_example.R
I had some issues getting started, but will make that a different issue.
Once I had a the code running in R Studio (v1.4, with R 4.0.3), these are potential issues.

At Line 31: install devtools. Outputs list of packages (n = 56). Instructions about "enter one or more numbers" seem to be repeated and confusing.


56: readr (1.3.1 -> 1.4.0 ) [CRAN]

Enter one or more numbers, or an empty line to skip updates:list.of.packages <- c("pls","dplyr","reshape2","here","plotrix","ggplot2","gridExtra","spectratrait")
Enter one or more numbers, or an empty line to skip updates:invisible(lapply(list.of.packages, library, character.only = TRUE))
Enter one or more numbers, or an empty line to skip updates:#--------------------------------------------------------------------------------------------------#
Enter one or more numbers, or an empty line to skip updates:

Entered “1”
Next output message:

There are binary versions available but the source versions are later:
binary source needs_compilation
waldo 0.2.3 0.2.4 FALSE
promises 1.1.1 1.2.0.1 TRUE

Do you want to install from sources the package which needs compilation? (Yes/no/cancel)

Entered “Yes” (maybe guidance to this should be given in instructions).

Continued running chunks, all working until Line 99.

Error in sample_info %>% select(Plant_Species = Latin Species, Species_Code = species code, :
could not find function "%>%"

Tried to load packages that might help with "%>%"

library(dplyr)
Error: package or namespace load failed for ‘dplyr’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
namespace ‘rlang’ 0.4.7 is already loaded, but >= 0.4.9 is required

library(magrittr)
Error in value[3L] :
Package ‘magrittr’ version 1.5 cannot be unloaded:
Error in unloadNamespace(package) : namespace ‘magrittr’ is imported by ‘tibble’, ‘testthat’ so cannot be unloaded

Testing ended at this point. Unable to continue.
I have recently used dplr in other code without an issue. Not sure what has changed.

@regnans
Copy link
Contributor Author

regnans commented Feb 13, 2021

Round 2, on pc.

Testing in Windows. Noticed this warning, but it did not stop code, so could go unnoticed.

WARNING: Rtools is required to build R packages, but is not currently installed.

Please download and install Rtools 4.0 from https://cran.r-project.org/bin/windows/Rtools/.

This website says: “Note that rtools40 is only needed build R packages with C/C++/Fortran code from source. By default, R for Windows installs the precompiled “binary packages” from CRAN, for which you do not need rtools!”

Running OK. Error at same point.

Error in sample_info %>% select(Plant_Species = Latin Species, Species_Code = species code, :
could not find function "%>%"

library(magrittr)

loads fine but does not solve issue.

library(dplyr)

solves issue.

Runs to line144

Error in qplot(cal.plsr.data[, paste0(inVar)], geom = "histogram", main = paste0("Calibration Histogram for ", :
could not find function "qplot”

library(ggplot2)

Starts again …

histograms <- grid.arrange(cal_hist_plot, val_hist_plot, ncol=2)
Error in grid.arrange(cal_hist_plot, val_hist_plot, ncol = 2) :
could not find function "grid.arrange"

Installed R tools and started again. Restarted R Studio
On second time through did not need to load dplyr

Everything ran. Labeling on some figures was a bit clunky (figure number labels sometimes not completely in the box, so hard to interpret).

@regnans
Copy link
Contributor Author

regnans commented Feb 13, 2021

Round 3, back on Mac. Restarted R Studio. Everything ran fine.
So in summary, on both machines I had to start running stuff, manually load dplr and then restart to get it to work. Perhaps.

@serbinsh
Copy link
Contributor

@regnans well first, yay it finally worked! But those issues are troubling and, annoyingly, more R/Rstudio than the package itself! That makes it very difficult to try and deal with.

My initial thought is that R wanted you to respond to upgrades with packages before running. Maybe we need to tell users to first install the package and answer any and all R prompts about upgrading packages.

I don't, for the life of me, understand why dplyr gave you such issues other than perhaps the install got corrupted the first time?

Not sure, but did it tell you you needed magittr? That isn't a dependency? Strange

As for plots, the best place to see those are in the output folder. the on screen is just to make it easier but the versions written to file are far better, and don't have those issues.

The challenge is that most of the problems, if not all, are issues with R and Rstudio, including how Rstudio plots graphs when the graph size/ graph window size is small but doesn't actually indicate a bug and as I said the graphic files will be fine.

Going to have to think about if/how any of this can be addressed other than telling users that these could be R issues they deal with and how to try and get around them

@serbinsh
Copy link
Contributor

in effect the output figures will /should look more like these versions

https://github.com/TESTgroup-BNL/PLSR_for_plant_trait_prediction/blob/master/vignettes/reseco_lma_plsr_example.md

@regnans
Copy link
Contributor Author

regnans commented Feb 15, 2021

Not sure, but did it tell you you needed magittr? That isn't a dependency? Strange

No, it didn't tell me it needed magittr. When it failed on %>% I searched for what packages that was in, and that led me to magittr and dplyr.

My initial thought is that R wanted you to respond to upgrades with packages before running. Maybe we need to tell users to first install the package and answer any and all R prompts about upgrading packages.

I think that is reasonable. There are a few things that could be included in the README to help newbies get started. It seemed that getting all of the packages up and then restarting R Studio sorted everything out. I'd be happy to help write some text for the README to help out the less R literate.

@serbinsh
Copy link
Contributor

@regnans that would be very helpful thanks!

@serbinsh
Copy link
Contributor

@regnans some questions

  1. "Load code into operating environment: how should this be done? Can someone add? (I hacked my way around this by cut and paste, but is there a better way?)."

I don't follow this? The scripts load all of the packages into R already

#--------------------------------------------------------------------------------------------------#
### Load libraries
# make sure required tools are available 
req.packages <- c("devtools")
new.packages <- req.packages[!(req.packages %in% installed.packages()[,"Package"])]
if(length(new.packages)) install.packages(new.packages, dependencies=c("Depends", "Imports",
                                                                       "LinkingTo"))
# install spectratrait package
devtools::install_github(repo = "TESTgroup-BNL/PLSR_for_plant_trait_prediction", dependencies=TRUE)
list.of.packages <- c("pls","dplyr","reshape2","here","plotrix","ggplot2","gridExtra","spectratrait")
invisible(lapply(list.of.packages, library, character.only = TRUE))
#--------------------------------------------------------------------------------------------------#

Again I think you issue was that you needed to first address R asking you what packages to update and because you skipped over that it failed? So does that mean we need another comment about first updating your packages first, then loading the R package and run it? @neo0351 ? That is, how would we tell folks to update R/packages and not conflate that with loading the R package?

  1. "Initial run to install packages: Step 1 in the example code will check for tools and packages and install what is required. An internet connection is required to run this step. The user will be required to respond to several prompts. (Suggested responses for standard set up; 1, Yes)."

This is true, but true for and R or R package. So are you asking that we explain how to update R first? or explain what it means to load R packages? Some clarification would help to make sure I understand what text would be helpful

  1. "Dealing with errors: This code was tested across a variety of operating systems and environments. In the case where most packages were being installed for the first time running subsequent Steps resulted in "could not fund function" errors in some instances. To avoid these errors it is recommended that the user restart their operating environment after installing packages in Step 1."

I think most problems are with people who just need to get their R environ ready. So wonder how we can walk someone through that? Again lots of this is, we expect a certain level of understanding of using R. We arent really expected to train someone how to use R, are we? Thats what I struggle with

@regnans
Copy link
Contributor Author

regnans commented Feb 19, 2021

  1. This step is about how to get the code running before the scripts load packages. I'm talking SUPER basic here. I see the code in GitHUb - how does the user get that into R/RStudio? cut and paste? link to Github? save the script as *.R somewhere and load from there? Run from Github? I don't know possibilities or the best way - very much a newbie question here.

  2. No, this was not about updating R. My intention was to provide guidance to what prompts the user will expect to see to get the packages loaded.

  3. I agree. The user should have some experience with R. This is not meant to be a "how to R". But, this was an error that I encountered on multiple systems, so others who don't have a lot of experience or are new to these specific packages might also encounter this issue.

@serbinsh
Copy link
Contributor

@regnans hmm......

For 1 I see your point and I don't yet have a very basic solution. Its too hard to express here whats up but there seems to be some issue with the fundamental "how do we get the code to a user" issue. That would usually be git clone or download zip and extract but I don't see any easy way right now to just download one of the scripts. THat said they do open in a browser which does mean you can do copy and paste

https://raw.githubusercontent.com/TESTgroup-BNL/PLSR_for_plant_trait_prediction/master/inst/scripts/spectra-trait_ely_leafN_plsr_bootstrap_example.R

But I think you are saying there needs to be a way to get the script locally so they can open in R studio and run it?

Lets think about this

@regnans
Copy link
Contributor Author

regnans commented Feb 19, 2021

Some people unfamiliar with GitHub would look for a "save as", which doesn't exist. Your suggested solution of instructions to download the zip and run from there is good. I will update that section in the README.

@serbinsh
Copy link
Contributor

serbinsh commented Mar 9, 2021

@regnans when you have a chance, lets make sure the latest PR addresses this and if so we can then close

@regnans
Copy link
Contributor Author

regnans commented Mar 9, 2021

yes, closing.

@regnans regnans closed this as completed Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants