opensafely-core / r-docker

Docker image for running R scripts in OpenSAFELY
1 stars 3 forks source link

add R packages: lcmm, dtwclust, bayesMCClust #110

Closed JamesAFarrell closed 1 year ago

JamesAFarrell commented 1 year ago

Hi, we'd like to do some trajectory modelling using these packages. Could they please be installed? Thanks!

https://cran.r-project.org/web/packages/lcmm/index.html https://cran.r-project.org/web/packages/dtwclust/index.html https://cran.microsoft.com/snapshot/2015-05-15/web/packages/bayesMCClust/index.html

remlapmot commented 1 year ago

(This is not a message from the team)

For bayesMCClust, as hinted at by the snapshot URL above, when we check its CRAN page https://cran.r-project.org/package=bayesMCClust we see it was archived from CRAN on 2018-01-23 therefore running install.packages('bayesMCClust') in the usual way will fail.

Screenshot 2022-09-22 at 10 47 23

That prompts the question, do the team want to allow installation of archived packages?

If you want to allow installation of archived packages, the easiest way I know to install it is using Microsoft CRAN snapshot as the repo in install.packages() as follows

install.packages("bayesMCClust", repos = "https://cran.microsoft.com/snapshot/2018-01-23")

In the repos URL, I recommend choosing a date as close as possible to the day of archival (and not the 2015 date in the URL above) because any missing dependency packages will also be installed from this date and you'd want those as current as possible.

You can tell my command above will likely work because the Microsoft snapshot URL for the package using the later date shows the package and not the archival message, i.e., https://cran.microsoft.com/snapshot/2018-01-23/web/packages/bayesMCClust/index.html

(An alternative installation method would be to use install.packages() to install the current version of the dependency packages [although I haven't checked if any of those have been archived] then install bayesMCClust from its .tar.gz file from its archive https://cran.r-project.org/src/contrib/Archive/bayesMCClust/)

wjchulme commented 1 year ago

Happy for lcmm and dtwclust to be added.

We've agreed to hold off on bayesMCClust as it's archived, which makes things complicated. And @JamesAFarrell has indicated there may be workarounds in this instance if needed.

evansd commented 1 year ago

@JamesAFarrell Would you be able to confirm whether version 5.5.10 of dtwclust would meet your needs (it's one version behind the current latest which is 5.5.11)?

I ask because the latest version introduces a dependency on a new version of the Matrix package and we'd rather not upgrade that as this point if we can avoid it.

JamesAFarrell commented 1 year ago

@evansd Yes I can confirm 5.5.10 of dtwclust will suffice for our analysis. Thanks for your help!

JamesAFarrell commented 1 year ago

lcmm and dtwclust have been installed. bayesMCClust is archived, so alternative workarounds will be sought.