hughjonesd / rcheology

Data on Base Packages for Previous Versions of R
https://hughjonesd.shinyapps.io/rcheology
Creative Commons Zero v1.0 Universal
39 stars 2 forks source link

Some functions with leading . are missing #4

Closed wch closed 6 years ago

wch commented 6 years ago

In the Shiny app at https://hughjonesd.shinyapps.io/rcheology/, some functions with a leading . are missing. For example .difftime is not there. Are a number of other base internal functions (which are listed if you run ?.difftime) are also missing, although some of them are present.

hughjonesd commented 6 years ago

This is because list-objects.R uses ls() not ls(all.names = TRUE). Using all.names=TRUE would get these functions but also a whole lot more (like .__S3MethodsTable__), which I'd have to parse manually.

I'm ambivalent about this. I'd like to be as complete as possible, but I also want to reflect the public API. Thoughts?

wch commented 6 years ago

Objects like .__S3MethodsTable__. and .subset2 actually are present in the data in the app, but it says that they're there for R 1.7.0-1.9.1. My guess is that after 1.9.1, R started hiding objects with a leading . by default.

I think it is very useful to also keep track of functions starting with .. For better or worse, those functions are effectively part of R's public API and are used in packages. For example, here's where .subset2 is used in packages on CRAN:

https://github.com/search?q=org%3Acran+subset2&type=Code

This issue came up because @hadley was looking for information about which versions of R added .Date and .difftime. cc @jimhester

hughjonesd commented 6 years ago

Ok. I’ll do it.

jimhester commented 6 years ago

At least those in the base package are definitely in the public API since all functions in the base package are implicitly exported and as @wch showed are used by packages on CRAN.

For other package shipped with R maybe you could think about only listing the exported functions though?

hughjonesd commented 6 years ago

How would I check which functions are exported? From R 1.7.0 I can use base::getNamespaceExports. Before that I guess there was no namespace mechanism - so does everything count as exported?

jimhester commented 6 years ago

I think that is reasonable, use getNamespaceExports() after 1.7.0 and just assume everything was exported before that.

hughjonesd commented 6 years ago

I'm gonna just grab everything and include a flag for exported. There are some weird things like datasets that wouldn't be exported. But it's hard to know what counts as a dataset.

I would like to keep the map from data to underlying R operations simple:

in dataset = found by ls(all.names=TRUE) exported flag = object name in getNamespaceExports

hughjonesd commented 6 years ago

Fixed and up on shinyapps.io. I'll push to CRAN shortly.

wch commented 6 years ago

Thanks!