Function for displaying arbitrary text as in 'help'.

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Function for displaying arbitrary text as in 'help'.

Nicolás San Martín
Hi all,

I am looking for a function that receives some text (any text) and displays
it to the user in the same way as the 'help' function does. Unlike 'cat',
that outputs the text in the current window, the one I'm looking for should
work as 'help' that, for example, in emacs ess opens a new buffer, in the
linux terminar displays it as the more command, etc. Is there any function
that does this?

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Function for displaying arbitrary text as in 'help'.

Duncan Murdoch-2
On 02/01/2019 8:47 a.m., Nicolás San Martín wrote:
> Hi all,
>
> I am looking for a function that receives some text (any text) and displays
> it to the user in the same way as the 'help' function does. Unlike 'cat',
> that outputs the text in the current window, the one I'm looking for should
> work as 'help' that, for example, in emacs ess opens a new buffer, in the
> linux terminar displays it as the more command, etc. Is there any function
> that does this?

Help is printed by the function

  utils:::print.help_files_with_topic

which is quite a long function because of all the possible ways to
display help.  You might be able to adapt it to your own needs, though
it won't be trivial.

Duncan Murdoch

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Function for displaying arbitrary text as in 'help'.

Duncan Murdoch-2
In reply to this post by Nicolás San Martín
On 02/01/2019 8:47 a.m., Nicolás San Martín wrote:
> Hi all,
>
> I am looking for a function that receives some text (any text) and displays
> it to the user in the same way as the 'help' function does. Unlike 'cat',
> that outputs the text in the current window, the one I'm looking for should
> work as 'help' that, for example, in emacs ess opens a new buffer, in the
> linux terminar displays it as the more command, etc. Is there any function
> that does this?
>

The file.show() function will display a text file without all the bells
and whistles of the help system; maybe it will be good enough.

Duncan Murdoch

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Function for displaying arbitrary text as in 'help'.

Jeff Newmiller
In reply to this post by Nicolás San Martín
You can probably cobble together something, but spitting large chunks of information at users when the program wants to is bad design. It would be better to make a vignette or help file in a package and put the associated code from which you had been planning to spit out that text.

On January 2, 2019 5:47:52 AM PST, "Nicolás San Martín" <[hidden email]> wrote:

>Hi all,
>
>I am looking for a function that receives some text (any text) and
>displays
>it to the user in the same way as the 'help' function does. Unlike
>'cat',
>that outputs the text in the current window, the one I'm looking for
>should
>work as 'help' that, for example, in emacs ess opens a new buffer, in
>the
>linux terminar displays it as the more command, etc. Is there any
>function
>that does this?
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>[hidden email] mailing list -- To UNSUBSCRIBE and more, see
>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.

--
Sent from my phone. Please excuse my brevity.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Function for displaying arbitrary text as in 'help'.

Nicolás San Martín
In reply to this post by Duncan Murdoch-2
Yes, the file.show() is good enough. Thanks

El mié., 2 ene. 2019 a las 13:48, Duncan Murdoch (<[hidden email]>)
escribió:

> On 02/01/2019 8:47 a.m., Nicolás San Martín wrote:
> > Hi all,
> >
> > I am looking for a function that receives some text (any text) and
> displays
> > it to the user in the same way as the 'help' function does. Unlike 'cat',
> > that outputs the text in the current window, the one I'm looking for
> should
> > work as 'help' that, for example, in emacs ess opens a new buffer, in the
> > linux terminar displays it as the more command, etc. Is there any
> function
> > that does this?
> >
>
> The file.show() function will display a text file without all the bells
> and whistles of the help system; maybe it will be good enough.
>
> Duncan Murdoch
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Function for displaying arbitrary text as in 'help'.

Nicolás San Martín
In reply to this post by Jeff Newmiller
In this case I am not able to store the text in a file, because it could be
modified at any time and I need to display the most recent version (I fetch
it from the internet). But I can assume that it is correctly organized for
displaying.

El mié., 2 ene. 2019 a las 14:31, Jeff Newmiller (<[hidden email]>)
escribió:

> You can probably cobble together something, but spitting large chunks of
> information at users when the program wants to is bad design. It would be
> better to make a vignette or help file in a package and put the associated
> code from which you had been planning to spit out that text.
>
> On January 2, 2019 5:47:52 AM PST, "Nicolás San Martín" <
> [hidden email]> wrote:
> >Hi all,
> >
> >I am looking for a function that receives some text (any text) and
> >displays
> >it to the user in the same way as the 'help' function does. Unlike
> >'cat',
> >that outputs the text in the current window, the one I'm looking for
> >should
> >work as 'help' that, for example, in emacs ess opens a new buffer, in
> >the
> >linux terminar displays it as the more command, etc. Is there any
> >function
> >that does this?
> >
> >       [[alternative HTML version deleted]]
> >
> >______________________________________________
> >[hidden email] mailing list -- To UNSUBSCRIBE and more, see
> >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.
>
> --
> Sent from my phone. Please excuse my brevity.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Function for displaying arbitrary text as in 'help'.

Duncan Murdoch-2
On 02/01/2019 1:36 p.m., Nicolás San Martín wrote:
> In this case I am not able to store the text in a file, because it could be
> modified at any time and I need to display the most recent version (I fetch
> it from the internet). But I can assume that it is correctly organized for
> displaying.

It is possible to have dynamic content in help pages.  Web pages (e.g.
generated using R-markdown or Shiny) are even more flexible for content,
but maybe not meeting your requirement for displaying in an ESS buffer
or Linux terminal window.

Duncan Murdoch

>
> El mié., 2 ene. 2019 a las 14:31, Jeff Newmiller (<[hidden email]>)
> escribió:
>
>> You can probably cobble together something, but spitting large chunks of
>> information at users when the program wants to is bad design. It would be
>> better to make a vignette or help file in a package and put the associated
>> code from which you had been planning to spit out that text.
>>
>> On January 2, 2019 5:47:52 AM PST, "Nicolás San Martín" <
>> [hidden email]> wrote:
>>> Hi all,
>>>
>>> I am looking for a function that receives some text (any text) and
>>> displays
>>> it to the user in the same way as the 'help' function does. Unlike
>>> 'cat',
>>> that outputs the text in the current window, the one I'm looking for
>>> should
>>> work as 'help' that, for example, in emacs ess opens a new buffer, in
>>> the
>>> linux terminar displays it as the more command, etc. Is there any
>>> function
>>> that does this?
>>>
>>>        [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>> 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.
>>
>> --
>> Sent from my phone. Please excuse my brevity.
>>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.