[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:04:32 CEST 2017
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...{{dropped:2}}
More information about the Bioc-devel
mailing list