Thank you very much for your response. I really appreciate it.

How can I define those vectors in my package? Another R script that possesses 
only
all the vectors? Which also needs documentation. Am I correct?

Best regards,
Arman

From: Vincent Carey<mailto:st...@channing.harvard.edu>
Sent: ‏سه شنبه,‏ ‏10 ‏دی ‏1398 ‏07:31
To: Arman Shahrisa<mailto:shahrisa.ar...@hotmail.com>
Cc: bioc-devel<mailto:bioc-devel@r-project.org>
Subject: Re: [Bioc-devel] Repetitive variables within multiple function



On Mon, Dec 30, 2019 at 9:35 PM Arman Shahrisa 
<shahrisa.ar...@hotmail.com<mailto: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<mailto: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 person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.


        [[alternative HTML version deleted]]

_______________________________________________
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel

Reply via email to