You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the great package - it's really helpful! I had started to cobble something much cruder together and so I was delighted when I found dsmextra!
I think I have found a couple of simple bugs. Apologies for not providing a complete reprex below, but I wasn't able to quickly pare down my segdata (327 rows) and predgrid (9124 rows) to make a minimal example that still displayed the behaviour in question.
1. Apply() sometimes returns the wrong type of structure
There are cases where apply() can return either a vector or matrix even though it was passed a dataframe, which messes up subsequent code.
There are two places in summarise_extrapolation.R where apply() is used to convert each column of a dataframe to character:
At line 144: resdf <- apply(resdf, 2, function(x) as.character(x)), and
At line 327: mic_resdf <- apply(mic_resdf, 2, function(x) as.character(x))
I have an example use case where apply() returns either a character vector or a 2-D character matrix on one of these rows instead of a dataframe, which messes up subsequent code that expects resdf or mic_resdf to be a dataframe.
For example, executing the following code where 'sst.sc' has no univariate or combinatorial extrapolation:
In this particular case, it fails at line 329 because apply() (at line 327) has returned a character vector and thus mic_resdf is no longer a dataframe at line 329.
Changing these two lines to use purrr::map_dfr() instead of apply() fixed the problem for me:
line 144: resdf <- purrr::map_dfr(resdf, as.character) and
line 327: mic_resdf <- purrr::map_dfr(mic_resdf, as.character)
2. max.univariate misspelled as max.univariates
There are four places in compare_covariates.R (on lines 245 and 250) where max.univariates is used, but I think you intended it to be max.univariate?
Line 245: min.univariate <- c(min.univariate, rep("-", times = length(max.univariates)-length(min.univariate)))
Line 250: max.univariates <- c(max.univariates, rep("-", times = length(min.univariate)-length(max.univariates)))
Hi and Happy New Year!
Thanks for the great package - it's really helpful! I had started to cobble something much cruder together and so I was delighted when I found
dsmextra
!I think I have found a couple of simple bugs. Apologies for not providing a complete reprex below, but I wasn't able to quickly pare down my segdata (327 rows) and predgrid (9124 rows) to make a minimal example that still displayed the behaviour in question.
1.
Apply()
sometimes returns the wrong type of structureThere are cases where
apply()
can return either a vector or matrix even though it was passed a dataframe, which messes up subsequent code.There are two places in
summarise_extrapolation.R
whereapply()
is used to convert each column of a dataframe tocharacter
:resdf <- apply(resdf, 2, function(x) as.character(x))
, andmic_resdf <- apply(mic_resdf, 2, function(x) as.character(x))
I have an example use case where
apply()
returns either a character vector or a 2-D character matrix on one of these rows instead of a dataframe, which messes up subsequent code that expectsresdf
ormic_resdf
to be a dataframe.For example, executing the following code where
'sst.sc'
has no univariate or combinatorial extrapolation:causes the following output:
In this particular case, it fails at line 329 because
apply()
(at line 327) has returned a character vector and thusmic_resdf
is no longer a dataframe at line 329.Changing these two lines to use
purrr::map_dfr()
instead ofapply()
fixed the problem for me:line 144:
resdf <- purrr::map_dfr(resdf, as.character)
andline 327:
mic_resdf <- purrr::map_dfr(mic_resdf, as.character)
2.
max.univariate
misspelled asmax.univariates
There are four places in
compare_covariates.R
(on lines 245 and 250) wheremax.univariates
is used, but I think you intended it to bemax.univariate
?Line 245:
min.univariate <- c(min.univariate, rep("-", times = length(max.univariates)-length(min.univariate)))
Line 250:
max.univariates <- c(max.univariates, rep("-", times = length(min.univariate)-length(max.univariates)))
In my use case, executing the following:
causes the following error:
Changing
max.univariates
tomax.univariate
on these two lines fixed the problem for me.Thanks!
Dave
The text was updated successfully, but these errors were encountered: