timjmiller / wham

State-space, age-structured fish stock assessment model
https://timjmiller.github.io/wham
Other
32 stars 16 forks source link

line 20 of script returns error #16

Closed jimianelli closed 5 years ago

jimianelli commented 5 years ago

input <- prepare_wham_input(asap3, recruit_model=2, model_name="SNEMA Yellowtail Flounder") Error in rep(1:data$n_years_indices, times = sapply(xl, length)) : invalid 'times' argument

brianstock commented 5 years ago

Thanks for reporting, I'll look into it. Sorry, didn't know others were trying to use this yet. We've made a lot of changes lately on the master branch without fully testing. Our plan going forward, once we release/announce a wham v1.0, will be to keep master tested and deployable.

jimianelli commented 5 years ago

it's at line 447 of the "prepare_wham_input.R" file. Or send a file that works so I can test?

On Mon, Aug 19, 2019 at 7:05 AM Brian Stock notifications@github.com wrote:

Thanks for reporting, I'll look into it. Sorry, didn't know others were trying to use this yet. We've made a lot of changes lately on the master branch without fully testing. Our plan going forward, once we release/announce a wham v1.0, will be to keep master tested and deployable.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/timjmiller/wham/issues/16?email_source=notifications&email_token=AAUW7YXWVQUUNJGB3N2K7LLQFKSDLA5CNFSM4IMXCOFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4TBSDY#issuecomment-522590479, or mute the thread https://github.com/notifications/unsubscribe-auth/AAUW7YSDQKVTT64XHLOXYV3QFKSDLANCNFSM4IMXCOFA .

-- Jim Ianelli

brianstock commented 5 years ago

Thanks - this bug got introduced when I modified prepare_wham_input to accommodate the more complex example 2 (5 indices with lots of missing years). Had to do with the default R conversion of matrix to list passed to apply. Now avoids conversion and uses lapply.

Example 1 script works again. I'll update ex 1 vignette, ex 2 script, and ex 2 vignette shortly.

jimianelli commented 5 years ago

On a fresh git pull and build

=> R CMD INSTALL --no-multiarch --with-keep.source wham

ead 1 item Read 1 item Error in rep(1:data$n_years_indices, times = sapply(xl, length)) : invalid 'times' argument

================================ so maybe it didn't get pushed or there's some residual code in package?

timjmiller commented 5 years ago

Hi Jim,

Your error points to line 507 in prepare_wham_input.R

Does the same thing happens when you install using devtools per the instructions on the github site? When I install the current version that way and run the example script it works although there are some warnings about the plots for Ecov stuff that needs to get optioned out when Ecov stuff is isn't being done.

prepare_wham_input is called on line 19 of the ex1_SNEMA_yellowtail_flounder.R file. So, you should only have to run those first 19 lines to find out if the error happens that way.

On Mon, Sep 9, 2019 at 7:33 AM Jim Ianelli notifications@github.com wrote:

On a fresh git pull and build

=> R CMD INSTALL --no-multiarch --with-keep.source wham

  • installing to library ‘/Users/jim/Library/R/3.6/library’
  • installing source package ‘wham’ ... using staged installation libs /usr/local/clang8/bin/clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/TMB/include" -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/RcppEigen/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c wham_v0.cpp -o wham_v0.o In file included from wham_v0.cpp:4: ./helper_functions.hpp:657:7: warning: unused variable 'n_selpars' [-Wunused-variable] int n_selpars = selpars.size(); ^ wham_v0.cpp:93:16: warning: unused variable 'year1_Ecov' [-Wunused-variable] DATA_INTEGER(year1_Ecov); // first year Ecov ^ wham_v0.cpp:92:16: warning: unused variable 'Ecov_mortality' [-Wunused-variable] DATA_INTEGER(Ecov_mortality); // Ecov index to use for mortality ^ wham_v0.cpp:91:16: warning: unused variable 'Ecov_growth' [-Wunused-variable] DATA_INTEGER(Ecov_growth); // Ecov index to use for growth ^ wham_v0.cpp:363:7: warning: unused variable 'nh' [-Wunused-variable] int nh = 1, na = n_years_model; ^ wham_v0.cpp:94:16: warning: unused variable 'year1_model' [-Wunused-variable] DATA_INTEGER(year1_model); // first year model ^ wham_v0.cpp:51:16: warning: unused variable 'n_NAA_sigma' [-Wunused-variable] DATA_INTEGER(n_NAA_sigma); ^ 7 warnings generated. /usr/local/clang8/bin/clang++ -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/clang8/lib -o wham.so wham_v0.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation installing to /Users/jim/Library/R/3.6/library/00LOCK-wham/00new/wham/libs R data * moving datasets to lazyload DB inst byte-compile and prepare package for lazy loading * help installing help indices building package indices installing vignettes testing if installed package can be loaded from temporary location checking absolute paths in shared objects and dynamic libraries testing if installed package can be loaded from final location testing if installed package keeps a record of temporary installation path
  • DONE (wham)

    library(wham)

load wham

library(wham)

source('~/_mymods/faithbasedassessmentmodel/wham/inst/example_scripts/ex1_SNEMA_yellowtail_flounder.R') .....

ead 1 item Read 1 item Error in rep(1:data$n_years_indices, times = sapply(xl, length)) : invalid 'times' argument

================================ so maybe it didn't get pushed or there's some residual code in package?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/timjmiller/wham/issues/16?email_source=notifications&email_token=AEIGN7GRN6B6WMFCG34DWILQIYX7LA5CNFSM4IMXCOFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6HHD3Q#issuecomment-529428974, or mute the thread https://github.com/notifications/unsubscribe-auth/AEIGN7GKVTYQCBQQBHWORRLQIYX7LANCNFSM4IMXCOFA .

jimianelli commented 5 years ago

ya, i did a pull and built locally but maybe I should do a devtools install. Seems like it should be the same thing but maybe it is local to my machine.

will try now

On Mon, Sep 9, 2019 at 6:53 AM Tim Miller notifications@github.com wrote:

Hi Jim,

Your error points to line 507 in prepare_wham_input.R

Does the same thing happens when you install using devtools per the instructions on the github site? When I install the current version that way and run the example script it works although there are some warnings about the plots for Ecov stuff that needs to get optioned out when Ecov stuff is isn't being done.

prepare_wham_input is called on line 19 of the ex1_SNEMA_yellowtail_flounder.R file. So, you should only have to run those first 19 lines to find out if the error happens that way.

On Mon, Sep 9, 2019 at 7:33 AM Jim Ianelli notifications@github.com wrote:

On a fresh git pull and build

=> R CMD INSTALL --no-multiarch --with-keep.source wham

  • installing to library ‘/Users/jim/Library/R/3.6/library’
  • installing source package ‘wham’ ... using staged installation libs /usr/local/clang8/bin/clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG

-I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/TMB/include"

-I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/RcppEigen/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c wham_v0.cpp -o wham_v0.o In file included from wham_v0.cpp:4: ./helper_functions.hpp:657:7: warning: unused variable 'n_selpars' [-Wunused-variable] int n_selpars = selpars.size(); ^ wham_v0.cpp:93:16: warning: unused variable 'year1_Ecov' [-Wunused-variable] DATA_INTEGER(year1_Ecov); // first year Ecov ^ wham_v0.cpp:92:16: warning: unused variable 'Ecov_mortality' [-Wunused-variable] DATA_INTEGER(Ecov_mortality); // Ecov index to use for mortality ^ wham_v0.cpp:91:16: warning: unused variable 'Ecov_growth' [-Wunused-variable] DATA_INTEGER(Ecov_growth); // Ecov index to use for growth ^ wham_v0.cpp:363:7: warning: unused variable 'nh' [-Wunused-variable] int nh = 1, na = n_years_model; ^ wham_v0.cpp:94:16: warning: unused variable 'year1_model' [-Wunused-variable] DATA_INTEGER(year1_model); // first year model ^ wham_v0.cpp:51:16: warning: unused variable 'n_NAA_sigma' [-Wunused-variable] DATA_INTEGER(n_NAA_sigma); ^ 7 warnings generated. /usr/local/clang8/bin/clang++ -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/clang8/lib -o wham.so wham_v0.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation installing to /Users/jim/Library/R/3.6/library/00LOCK-wham/00new/wham/libs R data * moving datasets to lazyload DB inst byte-compile and prepare package for lazy loading * help installing help indices building package indices installing vignettes testing if installed package can be loaded from temporary location checking absolute paths in shared objects and dynamic libraries testing if installed package can be loaded from final location testing if installed package keeps a record of temporary installation path

  • DONE (wham)

    library(wham)

load wham

library(wham)

source('~/_mymods/faithbasedassessmentmodel/wham/inst/example_scripts/ex1_SNEMA_yellowtail_flounder.R') .....

ead 1 item Read 1 item Error in rep(1:data$n_years_indices, times = sapply(xl, length)) : invalid 'times' argument

================================ so maybe it didn't get pushed or there's some residual code in package?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub < https://github.com/timjmiller/wham/issues/16?email_source=notifications&email_token=AEIGN7GRN6B6WMFCG34DWILQIYX7LA5CNFSM4IMXCOFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6HHD3Q#issuecomment-529428974 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AEIGN7GKVTYQCBQQBHWORRLQIYX7LANCNFSM4IMXCOFA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/timjmiller/wham/issues/16?email_source=notifications&email_token=AAUW7YXVDRK6STAMIYNLEGLQIZIOVA5CNFSM4IMXCOFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6HU7QQ#issuecomment-529485762, or mute the thread https://github.com/notifications/unsubscribe-auth/AAUW7YWNT6RXRVTYLUAWNALQIZIOVANCNFSM4IMXCOFA .

-- Jim Ianelli

jimianelli commented 5 years ago

yea that seemed to work. sorry for the pester! On to actually checking things out!

On Mon, Sep 9, 2019 at 6:53 AM Tim Miller notifications@github.com wrote:

Hi Jim,

Your error points to line 507 in prepare_wham_input.R

Does the same thing happens when you install using devtools per the instructions on the github site? When I install the current version that way and run the example script it works although there are some warnings about the plots for Ecov stuff that needs to get optioned out when Ecov stuff is isn't being done.

prepare_wham_input is called on line 19 of the ex1_SNEMA_yellowtail_flounder.R file. So, you should only have to run those first 19 lines to find out if the error happens that way.

On Mon, Sep 9, 2019 at 7:33 AM Jim Ianelli notifications@github.com wrote:

On a fresh git pull and build

=> R CMD INSTALL --no-multiarch --with-keep.source wham

  • installing to library ‘/Users/jim/Library/R/3.6/library’
  • installing source package ‘wham’ ... using staged installation libs /usr/local/clang8/bin/clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG

-I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/TMB/include"

-I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/RcppEigen/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c wham_v0.cpp -o wham_v0.o In file included from wham_v0.cpp:4: ./helper_functions.hpp:657:7: warning: unused variable 'n_selpars' [-Wunused-variable] int n_selpars = selpars.size(); ^ wham_v0.cpp:93:16: warning: unused variable 'year1_Ecov' [-Wunused-variable] DATA_INTEGER(year1_Ecov); // first year Ecov ^ wham_v0.cpp:92:16: warning: unused variable 'Ecov_mortality' [-Wunused-variable] DATA_INTEGER(Ecov_mortality); // Ecov index to use for mortality ^ wham_v0.cpp:91:16: warning: unused variable 'Ecov_growth' [-Wunused-variable] DATA_INTEGER(Ecov_growth); // Ecov index to use for growth ^ wham_v0.cpp:363:7: warning: unused variable 'nh' [-Wunused-variable] int nh = 1, na = n_years_model; ^ wham_v0.cpp:94:16: warning: unused variable 'year1_model' [-Wunused-variable] DATA_INTEGER(year1_model); // first year model ^ wham_v0.cpp:51:16: warning: unused variable 'n_NAA_sigma' [-Wunused-variable] DATA_INTEGER(n_NAA_sigma); ^ 7 warnings generated. /usr/local/clang8/bin/clang++ -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/clang8/lib -o wham.so wham_v0.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation installing to /Users/jim/Library/R/3.6/library/00LOCK-wham/00new/wham/libs R data * moving datasets to lazyload DB inst byte-compile and prepare package for lazy loading * help installing help indices building package indices installing vignettes testing if installed package can be loaded from temporary location checking absolute paths in shared objects and dynamic libraries testing if installed package can be loaded from final location testing if installed package keeps a record of temporary installation path

  • DONE (wham)

    library(wham)

load wham

library(wham)

source('~/_mymods/faithbasedassessmentmodel/wham/inst/example_scripts/ex1_SNEMA_yellowtail_flounder.R') .....

ead 1 item Read 1 item Error in rep(1:data$n_years_indices, times = sapply(xl, length)) : invalid 'times' argument

================================ so maybe it didn't get pushed or there's some residual code in package?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub < https://github.com/timjmiller/wham/issues/16?email_source=notifications&email_token=AEIGN7GRN6B6WMFCG34DWILQIYX7LA5CNFSM4IMXCOFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6HHD3Q#issuecomment-529428974 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AEIGN7GKVTYQCBQQBHWORRLQIYX7LANCNFSM4IMXCOFA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/timjmiller/wham/issues/16?email_source=notifications&email_token=AAUW7YXVDRK6STAMIYNLEGLQIZIOVA5CNFSM4IMXCOFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6HU7QQ#issuecomment-529485762, or mute the thread https://github.com/notifications/unsubscribe-auth/AAUW7YWNT6RXRVTYLUAWNALQIZIOVANCNFSM4IMXCOFA .

-- Jim Ianelli