vallenderlab / MicrobiomeR

A comprehensive and customizable R package for microbiome analysis.
https://vallenderlab.github.io/MicrobiomeR/
MIT License
20 stars 4 forks source link

Naming R files #3

Closed sdhutchins closed 5 years ago

sdhutchins commented 6 years ago

I'm not 100% sure on how to name some of the things I'm writing.

I could go with alpha_diversity.R. Maybe that's better than stats.R.

How modular do you want to get, @grabear? I've read some people suggest a function per R file. To me, that seems too much when we have a bunch of R files.

https://github.com/vallenderlab/MicrobiomeR/blob/sdh-patch/R/stats.R

grabear commented 6 years ago

Just play it by ear. I've got ~350 lines of code (excluding roxygen docs) in the phyloseq.R file. This includes: image

In this file there is a stats function (phyloseq_to_stats_dataframe). So maybe use alpha_diversity.R or <package>.R.

Personally, I'm using phyloseq.R, metacoder.R, <package>.R, etc. for support functions. And then putting anything else in files like correlation_plot.R, or heat_tree.R. There's also a utils.R for things like mkdir and set_path.

Many of the data manipulations that I've been doing for the correlation plots, have been turned into functions and placed in phyloseq.R for other people to use and maybe for future functionality.

grabear commented 6 years ago

How modular do you want to get, @grabear? I've read some people suggest a function per R file. To me, that seems too much when we have a bunch of R files.

I really just want balance and something that makes since. So if you find a good strategy to organize/name things let me know. I would say don't do 1 function per file, unless that makes since. But also don't put 50 functions per file, unless that makes sense.

For now I'm going to continue with the strategy of naming the .R files based on the packages used to process the data or the plots being created.

sdhutchins commented 6 years ago

Yeah, that's sort of what I was thinking, too. Could be valuable to have a plots.R.

I found that some of my functions might be using a phyloseq and microbiome function and really didn't necessarily apply to 1 package, but I'll think on it.

Can be easily moved around if needed.

grabear commented 5 years ago

I think we've got this covered!