Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some functions with leading . are missing #4

Closed
wch opened this issue Oct 4, 2018 · 9 comments
Closed

Some functions with leading . are missing #4

wch opened this issue Oct 4, 2018 · 9 comments

Comments

@wch
Copy link

wch commented Oct 4, 2018

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
Copy link
Owner

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
Copy link
Author

wch commented Oct 8, 2018

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
Copy link
Owner

Ok. I’ll do it.

@jimhester
Copy link

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
Copy link
Owner

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
Copy link

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

@hughjonesd
Copy link
Owner

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
Copy link
Owner

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

@wch
Copy link
Author

wch commented Oct 10, 2018

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants