Closed gshotwell closed 8 years ago
Thanks for the submission @GShotwell! I must say we haven't developed solid criteria about overlap of packages yet. I started a discussion over on the forum about it: https://discuss.ropensci.org/t/overlap-policy-for-package-onboarding/368. I think we'll figure it out soon so we can move forward on this. Please give us your thoughts!
In the meantime, Travis setup is easy and you can use devtools::use_travis()
to start setup and you'll find more instructions here: https://docs.travis-ci.com/user/languages/r/
Reviewers: @daattali Due date: 2016-05-24
Overall, a great package that is implemented well and provides clear value. I haven't used the other unit conversion packages, but I can see that convertr
is very simple and easy to use and clearly has a very wide range of units available (way more than I knew existed!)
CONDUCT.md
file; more infoNEWS.md
file; more infoNULL
or NA
being passed as different arguments (not mandatory, just to be even more foolproof)#' @noRd
for internal functions (I can see conversion_table.Rd and is_supported_unit.Rd in the "man" folder); more infoconvert
say I can run explore_units()
to see what units are available but that function doesn't exist@return
to the convert
function documentationrp66_symbol
and multi_unit
seem to be new variables)C+D*X
rather than C+B*X
convert
function could also benefit from having a dontrun
example that shows incompatible types (the README shows this, so it'd be nice to have it in the function examples as well)get_record(unit)
. It can also be used in the gadget codereq
call in the gadget needs to be namespaced to shiny::req
In the gadget, the code for creating the to/from dropdowns has some repetition and could be simplified by doing something like this (untested code, might not work out of the box):
units_list <- reactive({
if(input$si_unit == "All") {
unique(conversion_table$catalog_symbol)
} else {
choices <- conversion_table[conversion_table$base_unit == input$si_unit, "catalog_symbol"]
unique(choices)
}
})
output$from_unit <- shiny::renderUI({ shiny::selectInput("from_unit", "From Unit", units_list())) })
output$to_unit <- shiny::renderUI({ shiny::selectInput("to_unit", "To Unit", units_list())) })
Maybe I'm wrong, but I think something like that would work and it's cleaner and less repetitive
dom = ""
to the table's options list)convert
, when printing the names, consider using a different printing function instead of "print" so that the user won't see the ugly [1] ""
and so that the user can have better control over it if it makes sense; more info (if this is purely only for debugging purposes then maybe it's not needed)foo <- convert(5, "km", "mi", print_names = TRUE)
. It will print the origin/target but not the result, and when you print out the variable, only the result will be printed. Have you thought about this and whether this is the desired behaviour?explore_units()
I thought something like that would be a very useful addition to your package. How do I know what all available units are? How do I know which conversions are valid? I could see great value in functions for both these questions.vector
as an argument, it'd be a good idea to do some error checking on that input. Running convertr:::convert_gadget("a")
or convertr:::convert_gadget(letters)
does not do what I expectedfluidRow
in a column()
. Before image and after imagemyvalue <- convertr::convert_gadget()
. If you run the addin, then it would run the gadget and in the end use the output value to write it to the document instead of storing it in a variable. This is of course just a suggestion, but I think it would be a useful addition. You can see an example of this kind of functionality in the colourPicker gadget/addin: calling mycol <- shinyjs::colourPicker()
runs the gadget which means it will return a value, while running the addin will simply use that return value and write it like you are doing in your code. See the very short colourPickerAddin function to see how simple this can be Thanks for your extensive review, @daattali! Could you give an estimate of the hours you spent on it?
@GShotwell let @daattali or I know if you have questions. We aim for responses back to review within two weeks.
I spent 3-4 hours
Thanks so much for the amazing comments, I'll get right on them.
Thanks again for the great comments, I've learned a lot through this process. My comments are below. Mostly I made the recommended changes, but there were a couple of places where I decided not to, mostly in coding style areas (at what point to define a helper function).
All implemented except:
get_record()
function because it's slightly below my repetition limit, I think it's a bit harder to read with the helper rather than without. explore_units()
is added back inexplore_units()
has a lot of this functionality now, and I'm worried about making a gadget a bit too cluttered. return_value
argument to the gadget. So that you can either run it to generate an expression, or to do a conversion directly. The main reason I added the gadget along with the add-in was so that the user could start with a particular vector by calling convert_gadget(vector)
. I can't really think of a good use case where it's helpful to return a converted value rather than the call which generates the value, but I think your right there might be one, so may as well provide an option to return a value. Looking much better! I think the new explore_units()
is very useful.
I don't have too many new comments so I'll just dump them all together:
explore_units()
function exists if you want to know what units are availableIn convert.R, if you want to not run an example this is the correct syntax
#' \dontrun{
#' convert(1:20, "kg", "km2")
#' }
Thanks! I've implemented all of these.
Looks good to me :+1:
OK, we're about ready to go. Before we transfer this to our repo, @GShotwell, I notice that there's a build error, which looks like R CMD check
hanging on running the examples. I believe that this is because functions launching shiny apps should be wrapped in \dontrun{}
in examples. Could you fix this? Once there's a clean CI build we should be good to go.
Oh drat, I did a check and then thought "hey, let's just add a couple more examples." I've fixed the error and convertr is now passing the CMD check.
Great! OK, next steps:
[![ropensci\_footer](http://ropensci.org/public_images/github_footer.png)](http://ropensci.org)
ropenscilabs
!Also, if you intend to submit to CRAN:
data-raw
is a top-level directory. I believe you want to add this to .Rbuildignore. (Perhaps it used to be called data_retrieval
?)sudo
to false
in your .travis.yml
, and adding the following. This will run your tests across multiple R versions:r:
- release
- devel
I tried to transfer it, but keep getting this error: You don’t have admin rights to ropenscilabs
Any thoughts?
@GShotwell you should get an invitation to a team on ropenscilabs
- then you should be able to do the transfer
Provides extensive unit conversion in R, also includes RStudio add-in to assist the user in picking units.
https://github.com/GShotwell/convertr
None
Anyone with units to convert, mostly scientists and commodities analysts.
datamart
provides unit conversion, but with fewer units and a less extensible framework. (It's hard to add units to datamart). convertr has more units.udunits2
Provides the same or greater space of units as convertr, but requires access to an external API. Also udunits2 doesn't have an RStudio add-in. Convertr is based around a built-in conversion table so can be used without an API, it also has an RStudio add-in to assist the user in searching through available units.devtools
install instructionsI agree, so long as I can figure out how to use Travis.
No * [] Do you intend for this package to go on CRAN?
Yes * [ ] Does the package have a CRAN accepted license?
Yes * [ ] Did
devtools::check()
produce any errors or warnings? If so paste them below.No errors
Not a resubmission