AndreaCirilloAC / updateR

update your R version in a breeze ( on OSX) √
Other
143 stars 23 forks source link

Helper functions implmentation #28

Closed chuckleong21 closed 4 years ago

chuckleong21 commented 4 years ago

Hi, @AndreaCirilloAC . Interesting and amazing work! So I took a look at the codes in updateR.R. I found it a bit messy and helper functions are needed to make things look organized. For example, latest_r_version() returns a list containing elements that come in handy for executables in updateR():

update_avail
[1] TRUE

$latest
[1] "4.0.2"

$url
[1] "http://cran.rstudio.com/bin/macosx/R-4.0.2.pkg"

attr(,"current")
[1] "4.0.1"

list_packages() returns a vector of package names filtered out the base ones. ask_password() utilises readline() to guide useRs to enter admin password upon prompt message instead of feeding straight away into the old admin_password argument and exposing it in the global environment. check_compactability() specially responses to the situation where a user runs R 3.6 and macOS 10.12.x and wants to use updateR. In this case, check_compactability() will return the following error:

Error: Latest R Version 4.0.2 requires macOS at least 10.13 or higher,
        but 10.12 is running. Consider upgrading macOS or install legacy R binaries from
        http://cran.rstudio.com/bin/macosx/

Helper functions are not necessary to be exported and make them accessible to users and they use the package as before. But those functions make it easier to make changes and implement features in the future.

I could submit a pull request if you like my ideas here. But a little bit more information on the work done so far is needed to help me clarify some confusions.

AndreaCirilloAC commented 4 years ago

Hi @chuckleong21 , thank you for your proposals! I am currently involved in some other projects and I have not a lot of time left for polishing things up here on updateR. Nevertheless I think this is a useful tool for the #Rstats community so it would be great if you could help make it even more functional and useful.

So: welcome on board!

Which kind of clarifications do you need? How can I help you?

Thanks

chuckleong21 commented 4 years ago

What was the intent for file argument in updateR()? I found the argument was redundant in the tidying process: if users feel that there is a need to supply file argument with a local file path or a direct link of the file, it does somehow swing from the goal of {updateR} -- update R with a single command.

updateR() should handle the actions above properly inside R alone.