PaulMelloy / cercospoRa

A R package for determining the timing of Cercospora beticola epidemics in sugar beet
https://paulmelloy.github.io/cercospoRa/
Other
1 stars 1 forks source link

calc_c_closure example code does runs with an error #15

Closed PaulMelloy closed 1 month ago

PaulMelloy commented 5 months ago

Hi @nathanokole The calc_c_closure function example runs with an error. I think this is because there are two layers to the input parameter times and when running it N gets converted to a list. This makes the minpack.lm::nlsLM() function error as it does not expect N to be a list.

Are you able to amend this. I copied the example to the unit test script in ./tests/testthat/test-calc_c_closure.r If you are able to create a unit test file like I did for your read_sb_growth_parameter.R function that would be handy. It helps checking the package runs with iterative changes much easier.

nathanokole commented 5 months ago

This is a bit weird because the example works on my local repository. I just checked it again now, but I don't get any errors. Could you maybe show me the error message you get?

nathanokole commented 5 months ago

Oh, I could reproduce the error by cloning the main directory again to my local directory. The error was probably due to the replacement of raster by terra. The error is found in the function calc_c_closure (But i don't see any test for it. I am happy to create it if necessary :) ). The as.vector function produced a list for N. So I used as.numeric instead, and now it is working fine again.