Code Monkey home page Code Monkey logo

Comments (8)

jorainer avatar jorainer commented on July 17, 2024

I guess you refer to CompoundDb-methods.R file? Following Bioconductor's design guide classes should be put into a AllClasses.R, functions for a class into -functions.R and its methods into a -methods.R. I was a little lazy here, so I put the class along with its functions into CompoundDb.R. I did start to put methods into Compd-methods.R to keep them separately from the functions and to avoid getting a very large CompDb.R file.

Re duplication of methods and functions. Yes I tend to define all the functionality in internal functions and to keep the methods simple, just calling the internal functions. Package-internally I would then only call the functions. Function calls are slightly faster than method calls. Also I try to avoid having large functions, but split as much of the functionality into smaller chunks and put that into functions. That makes it easier to maintain and keep it bug-free (also you can define the unit tests for each small function, so shield better against unexpected behavior).
Generally, to don't get lost in code, you should only look at the exported functions first.

Generally I do try to use functions instead of methods (see also lgatto/MSnbase#111), but sometimes it's worth defining a method to better integrate with existing methods. The dbconn is one example. All annotation resources supporting the AnnotationDbi interface define it, so Bioconductor people know they can call dbconn to get the database interface.

What do you mean with

dbconn seems to need @nord ?

from compounddb.

stanstrup avatar stanstrup commented on July 17, 2024

I mean @noRD to keep it out of the list of functions...

My point was not about the code. But about the list of functions in the index.

image

It's the duplication of the functions in that list that I would like to avoid. It is confusing and gets long very fast.
I don't know if there is also a way to have more descriptive titles in the list.

from compounddb.

stanstrup avatar stanstrup commented on July 17, 2024

XCMS is suffering heavy from this:

image

from compounddb.

jorainer avatar jorainer commented on July 17, 2024

and poor @ nord that we mentioned/linked here :)

Yes, it's ugly and a big issue - especially in xcms. I'll have a look what I can do... do you have an idea to get rid of this?

from compounddb.

jorainer avatar jorainer commented on July 17, 2024

AFAIK each function/methods needs to be documented/have an \alias{} in an man page. So, using @noRd doesn't really help. Not adding an alias helps - but then R CMD check complains that the method is not documented.

from compounddb.

jorainer avatar jorainer commented on July 17, 2024

OK, removed the alias for dbconn and that worked. But I can not remove the alias for show.

from compounddb.

stanstrup avatar stanstrup commented on July 17, 2024

I tried yesterday playing around with the usual tricks:

  1. @keywords internal. (no use since it will apply to all grouped functions)
  2. @noRD, @rdname and @describeIn
  3. Removing alias for the methods

Removing the aliases work except that I don't think I figured why but dbconn-method only disappeared when I did @noRD on it.

I checked now again and check is not happy if I just do that. :(
I cannot find a combination of settings to fix this. really annoying... Google also failed me.

from compounddb.

stanstrup avatar stanstrup commented on July 17, 2024

Perhaps "Documenting classes, generics and methods" in https://cran.r-project.org/web/packages/roxygen2/vignettes/rd.html have some hint I am unable to decipher.

More that seems related: https://stackoverflow.com/questions/7356120/how-to-properly-document-s4-methods-using-roxygen2

from compounddb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.