[R] Getting sink to work with "message" on R 2.11.0 - what didI miss?
Faiz Rasool
faiz7r at gmail.com
Sat May 22 10:38:33 CEST 2010
Thank you to all of those who are trying to help me.
I am using Windows XP, and using a screen reader called JAWS. When I type
something at the console, I hear once what I have typed, and then the focus
is on the next line. Then if I press the up arrow key I get to hear the
function I just typed, not its output. For example if I type mean(x) and
then I press enter I will hear "[5]" if it is the mean of x. Then I will
hear ">". Now if I want to find out what was the mean of x by pressing the
up arrow key, I will only hear mean(x) and I will not hear [5]. My screen
reader does provide options to use different cursors to read command lines.
but if I have typed median(x) sd(x) var(x) length(x) after typing mean(x),
it takes a long time before I can move my cursor to the location where I can
hear the mean of x. If the results of the commands can be diverted to MS
Word it becomes comparatively easy for me to quickly move forward and
backward in the document. Following suggestion of Gregory Snow, I will look
at emacs. I could not find the txtStart function and TeachingDemos package
after typing TxtStart() and library(TeachingDemos) I am unable to decide how
to use the code provided by David Winsemius. Should I just copy that to
console and it will start to divert the output to a txt or a .doc file?
Thank you once again to all of those who have participated in this thread.
Faiz.
----- Original Message -----
From: "David Winsemius" <dwinsemius at comcast.net>
To: "Greg Snow" <Greg.Snow at imail.org>
Cc: <r-help at r-project.org>
Sent: Saturday, May 22, 2010 2:46 AM
Subject: Re: [R] Getting sink to work with "message" on R 2.11.0 - what didI
miss?
>
> On May 21, 2010, at 5:34 PM, Greg Snow wrote:
>
>> Look at txtStart and friends in the TeachingDemos package as an
>> alternative to sink that includes commands as well as output.
>
> Know the quality of Greg Snows work it will probably be better than mine,
> but perhaps:
>
> > capfn <- function(inp) {
> + instring <- deparse(substitute(inp))
> + capture.output(instring, inp, file="all.Rout") }
> > capfn(1+3)
>
> The file looks like this:
>
> [1] "1 + 3"
> [1] 4
>>
>> --
>> Gregory (Greg) L. Snow Ph.D.
>> Statistical Data Center
>> Intermountain Healthcare
>> greg.snow at imail.org
>> 801.408.8111
>>
>>
>>> -----Original Message-----
>>> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
>>> project.org] On Behalf Of Tal Galili
>>> Sent: Friday, May 21, 2010 3:21 PM
>>> To: David Winsemius
>>> Cc: r-help at r-project.org
>>> Subject: Re: [R] Getting sink to work with "message" on R 2.11.0 - what
>>> did I miss?
>>>
>>> Hi David,
>>>
>>> I want to get both the 4 and the "1+3" that created it.
>>>
>>> I am trying to help someone else on the mailing list that is looking
>>> for a
>>> way to "sink" the console into word, so he could have word read it to
>>> him
>>> (he is blind).
>>> I know how to do the second part, but the first part (using sink with
>>> the
>>> commands, and not just the output), I am somehow missing...
>>>
>>> Best,
>>> Tal
>>>
>>>
>>>
>>> ----------------Contact
>>> Details:-------------------------------------------------------
>>> Contact me: Tal.Galili at gmail.com | 972-52-7275845
>>> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew)
>>> |
>>> www.r-statistics.com (English)
>>> -----------------------------------------------------------------------
>>> -----------------------
>>>
>>>
>>>
>>>
>>> On Sat, May 22, 2010 at 12:17 AM, David Winsemius
>>> <dwinsemius at comcast.net>wrote:
>>>
>>>>
>>>> On May 21, 2010, at 5:02 PM, Tal Galili wrote:
>>>>
>>>> Hi all,
>>>>>
>>>>> I am trying to use type message with sink, like this:
>>>>>
>>>>> sink("all.Rout", type="message")
>>>>> 1+3
>>>>>
>>>>> sink()
>>>>>
>>>>> readLines(con = "all.Rout")
>>>>>
>>>>> So to get the following output:
>>>>>
>>>>> 1+3
>>>>>>
>>>>> [1] 4
>>>>>
>>>>> Obviously this doesn't work.
>>>>>
>>>>>
>>>> What are you trying to do? The sink help page has two rather dire
>>> warnings
>>>> about not using type="message", and using type="output would give
>>> you what
>>>> you ask:
>>>>
>>>>> sink("all.Rout", type="output")
>>>>
>>>>> 1+3
>>>>>
>>>>> sink()
>>>>>
>>>>> readLines(con = "all.Rout")
>>>> [1] "[1] 4"
>>>>
>>>> The extra "[1]" and quotes are from the readLines function, not from
>>>> all.Rout.
>>>>
>>>>
>>>> I tried some variations (based on the explanations in the help) but
>>> am
>>>>> missing something on how to make it work.
>>>>>
>>>>> Any suggestions?
>>>>>
>>>>> (p.s: I need this so to help Faiz Rasool in his latest post)
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Tal
>>>>>
>>>> --
>>>> David Winsemius, MD
>>>> West Hartford, CT
>>>>
>>>>
>>>
>>> [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posting-
>>> guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>
> David Winsemius, MD
> West Hartford, CT
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
----- Original Message -----
From: "David Winsemius" <dwinsemius at comcast.net>
To: "Greg Snow" <Greg.Snow at imail.org>
Cc: <r-help at r-project.org>
Sent: Saturday, May 22, 2010 2:46 AM
Subject: Re: [R] Getting sink to work with "message" on R 2.11.0 - what didI
miss?
>
> On May 21, 2010, at 5:34 PM, Greg Snow wrote:
>
>> Look at txtStart and friends in the TeachingDemos package as an
>> alternative to sink that includes commands as well as output.
>
> Know the quality of Greg Snows work it will probably be better than mine,
> but perhaps:
>
> > capfn <- function(inp) {
> + instring <- deparse(substitute(inp))
> + capture.output(instring, inp, file="all.Rout") }
> > capfn(1+3)
>
> The file looks like this:
>
> [1] "1 + 3"
> [1] 4
>>
>> --
>> Gregory (Greg) L. Snow Ph.D.
>> Statistical Data Center
>> Intermountain Healthcare
>> greg.snow at imail.org
>> 801.408.8111
>>
>>
>>> -----Original Message-----
>>> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
>>> project.org] On Behalf Of Tal Galili
>>> Sent: Friday, May 21, 2010 3:21 PM
>>> To: David Winsemius
>>> Cc: r-help at r-project.org
>>> Subject: Re: [R] Getting sink to work with "message" on R 2.11.0 - what
>>> did I miss?
>>>
>>> Hi David,
>>>
>>> I want to get both the 4 and the "1+3" that created it.
>>>
>>> I am trying to help someone else on the mailing list that is looking
>>> for a
>>> way to "sink" the console into word, so he could have word read it to
>>> him
>>> (he is blind).
>>> I know how to do the second part, but the first part (using sink with
>>> the
>>> commands, and not just the output), I am somehow missing...
>>>
>>> Best,
>>> Tal
>>>
>>>
>>>
>>> ----------------Contact
>>> Details:-------------------------------------------------------
>>> Contact me: Tal.Galili at gmail.com | 972-52-7275845
>>> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew)
>>> |
>>> www.r-statistics.com (English)
>>> -----------------------------------------------------------------------
>>> -----------------------
>>>
>>>
>>>
>>>
>>> On Sat, May 22, 2010 at 12:17 AM, David Winsemius
>>> <dwinsemius at comcast.net>wrote:
>>>
>>>>
>>>> On May 21, 2010, at 5:02 PM, Tal Galili wrote:
>>>>
>>>> Hi all,
>>>>>
>>>>> I am trying to use type message with sink, like this:
>>>>>
>>>>> sink("all.Rout", type="message")
>>>>> 1+3
>>>>>
>>>>> sink()
>>>>>
>>>>> readLines(con = "all.Rout")
>>>>>
>>>>> So to get the following output:
>>>>>
>>>>> 1+3
>>>>>>
>>>>> [1] 4
>>>>>
>>>>> Obviously this doesn't work.
>>>>>
>>>>>
>>>> What are you trying to do? The sink help page has two rather dire
>>> warnings
>>>> about not using type="message", and using type="output would give
>>> you what
>>>> you ask:
>>>>
>>>>> sink("all.Rout", type="output")
>>>>
>>>>> 1+3
>>>>>
>>>>> sink()
>>>>>
>>>>> readLines(con = "all.Rout")
>>>> [1] "[1] 4"
>>>>
>>>> The extra "[1]" and quotes are from the readLines function, not from
>>>> all.Rout.
>>>>
>>>>
>>>> I tried some variations (based on the explanations in the help) but
>>> am
>>>>> missing something on how to make it work.
>>>>>
>>>>> Any suggestions?
>>>>>
>>>>> (p.s: I need this so to help Faiz Rasool in his latest post)
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Tal
>>>>>
>>>> --
>>>> David Winsemius, MD
>>>> West Hartford, CT
>>>>
>>>>
>>>
>>> [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posting-
>>> guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>
> David Winsemius, MD
> West Hartford, CT
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list