On Mon, Dec 30, 2019 at 9:35 PM Arman Shahrisa <shahrisa.ar...@hotmail.com> wrote:
> Hi to all, > > I’m the maintainer of the package cbaf. The package relies on various > terms to find > the cancer studies that possess specific data e.g. RNA-Seq. > > These terms are used by three various functions. I was wondering maybe it > would be > much better to include them in a separate file such as zzz.R so that every > function > could read the same variables. I already use the zzz.R file to print a > message upon > package loading on console. > > What is the best way to achieve what I’m looking for? I really appreciate > any suggestions. > I don't really understand the question. I see some repetitiveness in grepping for "Tumor" in cbaf/R/* cbaf-availableData.R: "Tumor Samples with mRNA data (RNA Seq V2)", cbaf-availableData.R: "Tumors with mRNA data (RNA Seq V2)", cbaf-availableData.R: "Tumor Samples with mRNA data (RNA Seq)", cbaf-availableData.R: "Tumors with mRNA data (RNA Seq)", cbaf-availableData.R: microRNA.Seq_terms_L1 <- c("Tumors with microRNA data (microRNA-Seq)", cbaf-availableData.R: "Tumor Samples with microRNA data (microRNA-Seq)" ... cbaf-obtainMultipleStudies.R: c("Tumor Samples with mRNA data (RNA Seq V2)", cbaf-obtainMultipleStudies.R: "Tumors with mRNA data (RNA Seq V2)", cbaf-obtainMultipleStudies.R: "Tumor Samples with mRNA data (RNA Seq)", cbaf-obtainMultipleStudies.R: "Tumors with mRNA data (RNA Seq)", Is your question about how to avoid repetitive definition of string constants in multiple functions? There is no need to use zzz.R ... you can define your vectors of constants outside of functions in R code in your package. The following is found inside one of your functions, and can't be seen by other functions that need the same content. RNA.Seq_terms_L1 <- c("Tumor Samples with mRNA data (RNA Seq V2)", "Tumors with mRNA data (RNA Seq V2)", "Samples with mRNA data (RNA Seq V2)", "Tumor Samples with mRNA data (RNA Seq)", "Tumors with mRNA data (RNA Seq)", "Samples with mRNA data (RNA Seq)") But as long as this is defined outside of a function it will be accessible to any function in your package. It can be documented and exported like any other value or function, should this be desired. If not exported it will be private to code in the package. > Best regards, > Arman > > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioc-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/bioc-devel > -- The information in this e-mail is intended only for the ...{{dropped:18}} _______________________________________________ Bioc-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel