[Bioc-devel] How can I remove limit of row numbers that can be printed on console?

Martin Morgan martin.morgan at roswellpark.org
Fri Sep 8 22:47:30 CEST 2017


(Keeping the devel mailing list in the loop, so that  others with 
similar questions / answers can benefit / contribute)

On 09/08/2017 04:41 PM, Arman Shahrisa wrote:
> I tested your first solution (View(studies)). I added it to the end of 
> my code and everything worked perfectly. Do think I can use it this way 
> or I have to write instruction for the users (vignette) to run it themself?

in the vignette you could give the user a taste for what they'll see 
with `head()` in an evaluated chunk, and mention that they could use 
`View()` in a non-evaluated chunk, something like


   ```{r}
   x = ...
   head(x)
   ```

To explore this object interactively, try

   ```{r, eval=FALSE}
   View(x)
   ```

Martin
> 
> Best regards,
> 
> Arman
> 
> *From: *Martin Morgan <mailto:martin.morgan at roswellpark.org>
> *Sent: *Saturday, September 9, 2017 00:34
> *To: *Arman Shahrisa <mailto:shahrisa.arman at hotmail.com>; bioc-devel 
> <mailto:bioc-devel at r-project.org>
> *Subject: *Re: [Bioc-devel] How can I remove limit of row numbers that 
> can be printed on console?
> 
> On 09/08/2017 03:50 PM, Arman Shahrisa wrote:
>> Thank you very much for helping. I have a package in Bioconductor 
>> submission procedure.
>> 
>> One of package functions shows the available cancer studies, allowing 
>> the user to choose
>> 
>> from them.  I have two options: Saving the output to the package 
>> directory or printing it
>> 
>> on the console. Apparently, assigning the output to environment is not 
>> allowed,
>> 
>> unless user does it by arrow sign him/her self (To me, both look like 
>> the same!).
>> 
>> Therefore, I have to print the output on console. I’ve seen such 
>> approach in *cgdsr *package
>> 
>> without any truncation. I took a look through its R code and couldn’t 
>> figure it out. I thought
>> 
>> maybe somebody knows what to do?
>> 
>> My function also stores an excel file with the same output (to shre it 
>> with others ). There is no
>> 
>> logics behind saving the excel file and then opening it with R. So, I 
>> think at the same time results
>> 
>> should be stored as a variable or printed on console.
> 
> One way of using cgdsr is like
> 
>     library("cgdsr")
>     cbiop <- CGDS("http://www.cbioportal.org/public-portal/")
>     studies = getCancerStudies(cbiop)
>     View(studies)
> 
> does that fit your needs?
> 
> Another approach is to provide a simple way for the user to get more
> relevant data, for instance
> 
> queryStudies <- function(url, query) {
>       stopifnot(
>           is.character(url), length(url) == 1L, nzchar(url),
>           !is.na(url),
>           is.character(query), length(query) == 1L, nzchar(query),
>           !is.na(query)
>       )
>       cbiop <- CGDS(url)
>       studies = getCancerStudies(cbiop)
>       idx = Reduce(`|`, lapply(studies, grepl, pattern=query))
>       if (sum(idx) > 1000)
>           stop("'query' returned > 1000 matches; be more specific")
>       studies[idx, , drop=FALSE]
> }
> 
> used as
> 
>       > mystudies = queryStudies(url, "brca"))
>       > dim(mystudies)
>       [1] 9 3
> 
> which is very easy to work with, e.g., View()
> 
> Martin
> 
> 
>> 
>> Best wishes,
>> 
>> Arman
>> 
>> *From: *Martin Morgan <mailto:martin.morgan at roswellpark.org>
>> *Sent: *Friday, September 8, 2017 23:48
>> *To: *Arman Shahrisa <mailto:shahrisa.arman at hotmail.com>; bioc-devel
>> <mailto:bioc-devel at r-project.org>
>> *Subject: *Re: [Bioc-devel] How can I remove limit of row numbers that 
>> can be printed on console?
>> 
>> On 09/08/2017 02:11 PM, Arman Shahrisa wrote:
>>> 
>>> Hi everyone,
>>> 
>>> How can I prevent the R from truncating the printed result on console? I have to
>>> print the output on console and I can�t use options(max.print = 10000) in my
>>> function. What else I can do?
>> 
>> this isn't really the right forum for base R questions (the r-help
>> mailing list or StackOverflow might be more appropriate), but since you
>> ask on the wrong forum ;), maybe I'll ask about why you'd want to print
>> that much information to the console? you're not really going to read
>> through it, are you?
>> 
>> Martin
>> 
>>> 
>>> Sincerely
>>> Arman
>>> 
>>> 
>>>        [[alternative HTML version deleted]]
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> Bioc-devel at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>>> 
>> 
>> 
>> This email message may contain legally privileged and/or confidential 
>> information.  If you are not the intended recipient(s), or the employee 
>> or agent responsible for the delivery of this message to the intended 
>> recipient(s), you are hereby notified that any disclosure, copying, 
>> distribution, or use of this email message is prohibited.  If you have 
>> received this message in error, please notify the sender immediately by 
>> e-mail and delete this email message from your computer. Thank you.
>> 
> 
> 
> This email message may contain legally privileged and/or confidential 
> information.  If you are not the intended recipient(s), or the employee 
> or agent responsible for the delivery of this message to the intended 
> recipient(s), you are hereby notified that any disclosure, copying, 
> distribution, or use of this email message is prohibited.  If you have 
> received this message in error, please notify the sender immediately by 
> e-mail and delete this email message from your computer. Thank you.
> 


This email message may contain legally privileged and/or...{{dropped:2}}



More information about the Bioc-devel mailing list