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

Function 'recov' warning message when ST=TRUE #47

Open
AuroreF opened this issue Jun 29, 2020 · 6 comments
Open

Function 'recov' warning message when ST=TRUE #47

AuroreF opened this issue Jun 29, 2020 · 6 comments
Assignees
Labels

Comments

@AuroreF
Copy link

AuroreF commented Jun 29, 2020

Hello,
I would like to use the function 'recov' to compare my 64 scenarios in my data.frame "allscenario_dd", but a warning message appears (see above). It generates a "recov" data.frame, however I just have the rRec and SSMD SD values. rRec, base, SSMD or pvalues columns are not calculated (NA).
Is it a problem linked to the fact that I didn't do any Sensitivty Analysis on my models (but 64 different scenarios whith different combinaisons) ?
Thanks in advance, I don't know what to do to fix this. I'm a new VortexR user so it could be a very basic problem there...

recov <- rRec(allscenario_dd, project="/home/aurore/Documents/Rainette_FGB/VORTEX10/Parameters-tests-RFGB.xlm",scenario='Basic dd', ST=FALSE, runs=1000, yr0=1, yrt=25,save2disk=FALSE,dir_out='DataAnalysis/rRec')
Warning message:
In [.data.table(data, J(yr0:yrt), .(rruns = r.stoch * runs, SDruns = SD.r. * :
Item 1 of j's result for group 1 is zero length. This will be filled with 25 NAs to match the longest column in this result. Later groups may have a similar problem but only the first is reported to save filling the warning buffer.

@florianm
Copy link
Collaborator

Hi @AuroreF, thanks for the bug report and for giving vortexR a whirl!
@carlopacioni probably knows best about the Vortex side and could maybe advise whether he sees a possible issue there.
Would you be able to provide a reproducible example without leaking any sensitive data? What's the smallest (set of) file(s) you can reproduce this error with?

@carlopacioni
Copy link
Owner

Hi @AuroreF, the error suggests you have no data in the first or more columns. It is hard to say what is going wrong without a reproducible example or having a look at your data. If you send me your data (you can save them with save(data, file="data.rda")), I'm happy to take a look. You can send them to me privately at carlo.pacioni@delwp.vic.gov.au
Cheers,
carlo

@AuroreF
Copy link
Author

AuroreF commented Jun 30, 2020

Hi, thank you very much, your quick return is appreciated ! I just sent my data to @carlopacioni.

@carlopacioni carlopacioni added bug and removed question labels Jul 1, 2020
@carlopacioni
Copy link
Owner

Hi @AuroreF,
there were two problems in your data. One is that the default name of the column with the scenario names was changed to
ï..scen.name
I suspect you may have saved the collate_dat output to disk as .csv or similar and then read that back in with one of Hadley Wickham R packages, is that possible? That column is generated internally by vortexR and I don't think I have made any changes in the recent version that would cause that problem, but please let me know if you think otherwise.
The second issue is indeed a bug. It seems that at some point Vortex changed the 'stochastic r' default name. Hence, the code is not able to identify the correct name of the column and fails (miserably!) returning a column with NA. I'll release a new version of the package as soon as I have a chance to run an internal check and select the correct name based on the version of Vortex that the user is running, but for now you should be able to fix the problem running the following to modify your collate_dat output.

names(allscenario_dd)[1] <- "scen.name"
names(allscenario_dd)[9] <- "r.stoch"
recov <- rRec(allscenario_dd, project="Parameters-tests-RFGB", scenario='Basic dd', 
              ST=FALSE, runs=1000, yr0=1, yrt=25, 
              save2disk=FALSE,dir_out='DataAnalysis/rRec')

Let me know if this works for you please.

Cheers,
carlo

P.S. you don't need to provide the path or the .XML file to the project argument, but just the name of the project you want to be used to name the outfiles when save2disk=TRUE.

@AuroreF
Copy link
Author

AuroreF commented Jul 1, 2020

Hi @carlopacioni,
Indeed I noticed that column name was changed! But I never thought that's where the bug came from. Thank you very much, it works perfectly with your code.

You are right, I decided to save the originial data.frame generated by collate_dat() function into a .CVS, because 13 columns of my data were generated with an unknown name (for "Nalleles", "Nlethals", "TE", "medTE" + associated SE and SD + GS1 function). However I didn't change "stoch.r" into "r.stoch" during the change so I guess it could happen again to others.

Again, thank you and let me congratulate you for the amount of work your team have done to create the fabulous package, and the energy you give to answer user's questions.
Cheers,
Aurore

@carlopacioni
Copy link
Owner

yep, just talked to Bob Lacy and he is going to double-check what headings are going to stay and which are going to change. Once that is done, I will fix the code to avoid problems for other users.
Thank you very much for reporting this, and thank you for your kind words about the package. We are happy you found it useful.

cheers,
carlo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants