79 new function install depricated package#80
Conversation
There was a problem hiding this comment.
At the moment, I can't really test if the function works or not using the examples. The following adjustments would be needed:
- I would include another package than sp in the examples. sp is required by fistools and will be already installed upon loading fistools. So if I uninstall it and restart the session, upon loading fistools sp is automatically installed again.
- I would also include another package than maptools. There is no version of maptools for my current version of R (4.5.0). So I haven't been able to reinstall it after removing (although your function did work and brought me to the CRAN archive where I could pick one, there just isn't one availabel for R 4.5.0)
- Depricated should be deprecated. This will need to be adjusted in all places where it is misspelled.
- Again a few notes popping up "No visual binding for global variable...". Same fix as before.
- I would adjust the print part at the end of the function to include two different options depending on wether the package was already installed or not (you expect it not to be installed, but in case it is, the function will not reinstall the package which may be in a different version than you wanted it to be and this is not shown as the message just says that the package is installed). In that case, I would use
print(paste0(package_name," (Version ", packageVersion(package_name),") is already installed"))and in the case that it was newly installed by the function I would useprint(paste0(package_name," (Version ", packageVersion(package_name),") is installed \U0001F389")) - add utils:: before askYesNo and browsURL and add utils to Imports in the description file
|
I was also wondering if it may be useful to broaden the functionality of the function, so it can be used for installing a specific version of a package even when the package is not deprecated and it had been installed before? In the latter case, a pop-up could appear saying that a certain version of the package has already been installed and if you'd like to overwrite that (I'm saying this because I was in that situation when coding wiSDM)? I guess you can largely use the same rationale that has already been implemented? |
Good idea |
Een helper functieje om depricated packages te installeren moesten ze bij de gebruiker ontbreken en ze vervangen is niet mogelijk door een gebrek aan een goed alternatief of door tijdsgebrek.