juba / rainette

R implementation of the Reinert text clustering method
https://juba.github.io/rainette/
53 stars 7 forks source link

palette.colors & asplit error #11

Closed yoannfol closed 2 years ago

yoannfol commented 2 years ago

Hi Julien,

First of all thanks fr the amazing job.

I tried to use rainette in a Dataiku R environment and everything is working well on the example provided up to the graph.

rainette_plot(res, dtm)

“Error in : 'palette.colors' is not an exported object from 'namespace:grDevices'”

It is the same with the rainette_explor(res, dtm, corpus) image

The shiny app is working well except that.

I noticed a second error on my side as well in rainette2(res1, res2, max_k = 5)

Error in asplit(., 1): could not find function "asplit" Traceback:

  1. rainette2(res1, res2, max_k = 5)
  2. progressr::with_progress({ . p <- progressr::progressor(steps = 5) . groups1 <- get_groups(x) . groups2 <- get_groups(y) . p() . if (nrow(groups1) != nrow(groups2)) { . stop("! Number of documents in both clustering results must be the same") . } . n_tot <- nrow(groups1) . cross_groups <- groups_crosstab(groups1, groups2, min_members, . min_chi2) . p() . cross_groups <- crosstab_add_members(cross_groups, groups1, . groups2) . p() . if (nrow(cross_groups) < 2) { . stop("! Not enough valid classes to continue. You may try a lower min_members value.") . } . if (!full) { . cross_groups <- crosstab_keep_max(cross_groups) . } . sizes <- cross_sizes(cross_groups) . p() . partitions <- list() . partitions[[1]] <- which(sizes == 0, arr.ind = TRUE, useNames = FALSE) %>% . asplit(1) . p() . })
  3. which(sizes == 0, arr.ind = TRUE, useNames = FALSE) %>% asplit(1)

Here is my session info to help the debug:

R version 3.5.2 (2018-12-20) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Debian GNU/Linux 10 (buster)

Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.8.0 LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.8.0

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] shiny_1.6.0 rainette_0.3.0 quanteda_3.2.1

loaded via a namespace (and not attached): [1] Rcpp_1.0.6 lattice_0.20-41 tidyr_1.2.0
[4] png_0.1-7 digest_0.6.27 ggwordcloud_0.5.0
[7] utf8_1.1.4 mime_0.10 RSpectra_0.16-0
[10] IRdisplay_1.1 R6_2.5.0 repr_1.1.4
[13] evaluate_0.14 nsyllable_1.0.1 highr_0.8
[16] ggplot2_3.3.3 pillar_1.5.1 rlang_0.4.10
[19] uuid_1.0-3 miniUI_0.1.1.1 jquerylib_0.1.3
[22] Matrix_1.2-15 stringr_1.4.0 munsell_0.5.0
[25] compiler_3.5.2 httpuv_1.5.5 pkgconfig_2.0.3
[28] base64enc_0.1-3 htmltools_0.5.1.1 tidyselect_1.1.0
[31] tibble_3.1.0 gridExtra_2.3 progressr_0.10.0
[34] dendextend_1.15.2 fansi_0.4.2 viridisLite_0.4.0
[37] crayon_1.4.1 dplyr_1.0.5 later_1.1.0.1
[40] grid_3.5.2 jsonlite_1.7.2 xtable_1.8-4
[43] gtable_0.3.0 lifecycle_1.0.0 magrittr_2.0.1
[46] scales_1.1.1 RcppParallel_5.1.5 cachem_1.0.4
[49] stringi_1.5.3 viridis_0.6.2 promises_1.2.0.1
[52] bslib_0.2.4 ellipsis_0.3.1 stopwords_2.3
[55] generics_0.1.0 vctrs_0.3.8 fastmatch_1.1-3
[58] IRkernel_1.3 tools_3.5.2 quanteda.textstats_0.95 [61] glue_1.4.2 purrr_0.3.4 fastmap_1.1.0
[64] colorspace_2.0-0 pbdZMQ_0.3-7 sass_0.3.1

Thanks!

juba commented 2 years ago

The problem comes from your R version, which is too old : the asplit() function has been introduced in R 3.6.0.

Is it possible for you to upgrade to a newer R version ?

yoannfol commented 2 years ago

Thanks for the prompt answer.

This is what I supposed but I was not able to find the R version requirements.

Is it the same for the grDevices::palette.colors() ?

I should be able to upgrade to R 3.6 (not 4.x) as it is not supported in Dataiku yet. Your package is a perfect complement to the visual preparation and analysis you can do with this tool.

Thanks

-

Yoann FOL

Founder & CEO - Data Scientist

+65 8753 7946

www.dathappy.com

Empowering underprivileged people around the globe,

we support the Innovation & Growth of purpose-driven organizations

WeAreDathappy

On Tue, Mar 1, 2022, 10:27 PM Julien Barnier @.***> wrote:

The problem comes from your R version, which is too old : the asplit() function has been introduced in R 3.6.0.

Is it possible for you to upgrade to a newer R version ?

— Reply to this email directly, view it on GitHub https://github.com/juba/rainette/issues/11#issuecomment-1055876525, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFSK5BJKRYKAXKDZQ4FVSPTU52DTTANCNFSM5PVCDXZQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

juba commented 2 years ago

Ah, my bad, you're right, the palette.colors() error won't be fixed by upgrading to 3.6, as the function has been introduced in R 4.0.0.

As palette.colors() is only used once, I replaced it with a manual colors vector in the development version. It should make the package compatible with R 3.6 (I hope).

rodtaq commented 2 years ago

Hello Juba thks for your Rainette tool, I have the same issue, the dev version is on the cran ? I can't use the un-compile source, only the binairies, I tried each version on the cran but I 've got the same issues with the color (and can't upgrade yet to R4) When do you think th binaireies with the little change on color will be online. Merci et bon week end Rod

juba commented 2 years ago

You are on Windows ? Did you manage to install rainette 0.3.0 from CRAN ?

rodtaq commented 2 years ago

yes windows, package 0.3.0 from Cran, need to rebuil Rccp than found the color problem

juba commented 2 years ago

And it doesn't work if you install it from source ? I thought that CRAN only provided binaries for R > 4.0...

rodtaq commented 2 years ago

no I can only with binaries, my devtools still have problem (behind firewall and admin pb). And your binaries are looking to the same version (0.3) even the one with dvlt in the rep Or elsewehere you are right the best was to use the source ... shame

juba commented 2 years ago

I'm not sure this will solve the issue, but binaries package for Windows of the development version are available via r-universe. Here is the link for the current latest commit :

https://github.com/r-universe/juba/actions/runs/1921246550

I think package-windows-oldrel should be the binary for R 4.0, and package-windows-release for R 4.1. Not sure you will be able to install them on R 3.6 though ?

rodtaq commented 2 years ago

yes it solved the problem :) Many thanks, maybe other problem can happen because of R version I use, one day I'll have to upgrade ...

thanks for everything and your prompt help !

juba commented 2 years ago

You're welcome, glad it solved the problem !

yoannfol commented 2 years ago

I managed to upgrade R to 3.6 on my Dataiku server and I am on Linux server.

Could you push the color change to an official version on CRAN? Best way to install it in an environment in the tool just by giving the name of a package to add.

Or when do you plan to have it done?

It will normally solve my color issue as the rest works for now,

Thanks

juba commented 2 years ago

Unfortunately it is not possible to publish new versions to CRAN too frequently, so I'm not sure when the next publication will be. But if your are on a Linux server you may be able to install the development version either with remotes, or from r-universe ?

install.packages("rainette", repos = "https://juba.r-universe.dev")
yoannfol commented 2 years ago

I have been able to find a solution for that with the r-universe repo and settings in the tool.

Thanks a lot and keep the great work going