Quantcast

is there a formatted output in R?

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

is there a formatted output in R?

LosemindL
something like "sprintf" in C?

so I can do:

print(sprintf("the correct result is %3.4f\n", myresult));

-------

Also, I am desperately looking for a "clear console screen"  function in
R...

thanks a lot!

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: is there a formatted output in R?

Thomas Lumley
On Fri, 10 Mar 2006, Michael wrote:

> something like "sprintf" in C?
>
> so I can do:
>
> print(sprintf("the correct result is %3.4f\n", myresult));

Did you try this line of code? It actually works in R, although you would
probably prefer cat() instead of print().

  -thomas

>
> -------
>
> Also, I am desperately looking for a "clear console screen"  function in
> R...
>
> thanks a lot!
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

Thomas Lumley Assoc. Professor, Biostatistics
[hidden email] University of Washington, Seattle

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: is there a formatted output in R?

LosemindL
Oh yeah, it worked... I got it typed wrong in R console... that's why...

but why is cat() preferred?


On 3/10/06, Thomas Lumley <[hidden email]> wrote:

>
> On Fri, 10 Mar 2006, Michael wrote:
>
> > something like "sprintf" in C?
> >
> > so I can do:
> >
> > print(sprintf("the correct result is %3.4f\n", myresult));
>
> Did you try this line of code? It actually works in R, although you would
> probably prefer cat() instead of print().
>
>        -thomas
>
> >
> > -------
> >
> > Also, I am desperately looking for a "clear console screen"  function in
> > R...
> >
> > thanks a lot!
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
> >
>
> Thomas Lumley                   Assoc. Professor, Biostatistics
> [hidden email]        University of Washington, Seattle
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: is there a formatted output in R?

Thomas Lumley
On Fri, 10 Mar 2006, Michael wrote:

> Oh yeah, it worked... I got it typed wrong in R console... that's why...
>
> but why is cat() preferred?

In this context, because it translates the \n to a newline and doesn't
precede the output by [1].

So, if you are actually producing pretty output with sprintf() you
probably want cat(), but if you have a vector of formatted text and you
want to look at it (as data), print() would be better.

  -thomas



>
> On 3/10/06, Thomas Lumley <[hidden email]> wrote:
>>
>> On Fri, 10 Mar 2006, Michael wrote:
>>
>>> something like "sprintf" in C?
>>>
>>> so I can do:
>>>
>>> print(sprintf("the correct result is %3.4f\n", myresult));
>>
>> Did you try this line of code? It actually works in R, although you would
>> probably prefer cat() instead of print().
>>
>>        -thomas
>>
>>>
>>> -------
>>>
>>> Also, I am desperately looking for a "clear console screen"  function in
>>> R...
>>>
>>> thanks a lot!
>>>
>>>       [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> [hidden email] mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide!
>> http://www.R-project.org/posting-guide.html
>>>
>>
>> Thomas Lumley                   Assoc. Professor, Biostatistics
>> [hidden email]        University of Washington, Seattle
>>
>

Thomas Lumley Assoc. Professor, Biostatistics
[hidden email] University of Washington, Seattle

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: is there a formatted output in R?

Douglas Grove
In reply to this post by LosemindL
You really need to learn how to do some searching, as you seem to
be constantly asking questions you can answer yourself

help.search("sprintf")


On Fri, 10 Mar 2006, Michael wrote:

> something like "sprintf" in C?
>
> so I can do:
>
> print(sprintf("the correct result is %3.4f\n", myresult));
>
> -------
>
> Also, I am desperately looking for a "clear console screen"  function in
> R...
>
> thanks a lot!
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: is there a formatted output in R?

LosemindL
In reply to this post by LosemindL
Great! It worked! Thank you so much!

Now since it worked greatly, how can I put this function into my own library
or package, so later on I can call this function from my other scripts?

Thanks a lot!


On 3/10/06, jim holtman <[hidden email]> wrote:

>
>  The archives had the following in it:
>
>  [R] how to clear screen in R-console?
>
>    - *This message*: [ Message body<http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70722.html#start>] [ More
>    options<http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70722.html#options2>]
>    - *Related messages*: [ Next message<http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70723.html>] [ Previous
>    message <http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70721.html>] [ In
>    reply to<http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70708.html>] [ Next
>    in thread<http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70800.html>] [
>    Replies<http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70722.html#replies>]
>
>  *From*: Gabor Grothendieck <ggrothendieck<ggrothendieck?Subject=Re:%20[R]%20how%20to%20clear%20screen%20in%20R-console?>>
>
> *Date*: Fri, 17 Feb 2006 12:36:51 -0500
>
> Here is a version that uses rcom instead of RDCOMClient.
> This has the advantage that rcom is on CRAN.
>
> cls <- function() {
>         require(rcom)
>         wsh <- comCreateObject("Wscript.Shell")
>         comInvoke(wsh, "SendKeys", "\014")
>         invisible(wsh)
> }
> cls() # test
>
> On 2/17/06, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
> *> Here is a translation of Norm Olsen's vbscript code into pure R. *
> *> This is intended for use with the Windows Rgui interface. *
>
>
>
>
>  On 3/10/06, Michael <[hidden email]> wrote:
>
> > something like "sprintf" in C?
>
> so I can do:
>
> print(sprintf("the correct result is %3.4f\n", myresult));
>
> -------
>
> Also, I am desperately looking for a "clear console screen"  function in
> R...
>
> thanks a lot!
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
>
>
>
>
> --
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390 (Cell)
> +1 513 247 0281 (Home)
>
> What the problem you are trying to solve?
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: is there a formatted output in R?

Gavin Simpson
On Fri, 2006-03-10 at 22:50 -0800, Michael wrote:
> Great! It worked! Thank you so much!
>
> Now since it worked greatly, how can I put this function into my own library
> or package, so later on I can call this function from my other scripts?
>
> Thanks a lot!

Michael,

Read the two manuals that cover writing functions and preparing
*packages* of code, which come with R or get them here:

http://cran.r-project.org/manuals.html

"An Introduction to R" and "Writing R Extensions",

After reading and digesting, if you still have questions then post them
to the list. People here provide their time for free and it is not much
to expect posters to try to help themselves out first - especially as
the developers have gone to such great lengths to produce quality
documentation that explains all of this.

HTH

G

>
>
> On 3/10/06, jim holtman <[hidden email]> wrote:
> >
> >  The archives had the following in it:
> >
> >  [R] how to clear screen in R-console?
> >
> >    - *This message*: [ Message body<http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70722.html#start>] [ More
> >    options<http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70722.html#options2>]
> >    - *Related messages*: [ Next message<http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70723.html>] [ Previous
> >    message <http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70721.html>] [ In
> >    reply to<http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70708.html>] [ Next
> >    in thread<http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70800.html>] [
> >    Replies<http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70722.html#replies>]
> >
> >  *From*: Gabor Grothendieck <ggrothendieck<ggrothendieck?Subject=Re:%20[R]%20how%20to%20clear%20screen%20in%20R-console?>>
> >
> > *Date*: Fri, 17 Feb 2006 12:36:51 -0500
> >
> > Here is a version that uses rcom instead of RDCOMClient.
> > This has the advantage that rcom is on CRAN.
> >
> > cls <- function() {
> >         require(rcom)
> >         wsh <- comCreateObject("Wscript.Shell")
> >         comInvoke(wsh, "SendKeys", "\014")
> >         invisible(wsh)
> > }
> > cls() # test
> >
> > On 2/17/06, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
> > *> Here is a translation of Norm Olsen's vbscript code into pure R. *
> > *> This is intended for use with the Windows Rgui interface. *
> >
> >
> >
> >
> >  On 3/10/06, Michael <[hidden email]> wrote:
> >
> > > something like "sprintf" in C?
> >
> > so I can do:
> >
> > print(sprintf("the correct result is %3.4f\n", myresult));
> >
> > -------
> >
> > Also, I am desperately looking for a "clear console screen"  function in
> > R...
> >
> > thanks a lot!
> >
> >        [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> > http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> >
> >
> >
> >
> > --
> > Jim Holtman
> > Cincinnati, OH
> > +1 513 646 9390 (Cell)
> > +1 513 247 0281 (Home)
> >
> > What the problem you are trying to solve?
> >
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson                     [T] +44 (0)20 7679 5522
ENSIS Research Fellow             [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC                 [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography       [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way                    [W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: is there a formatted output in R?

LosemindL
Thank you for your reminder!

I think you don't have to tell me to read the document.

I have done that many times already.

My feeling after reading the "creating package" manual is that my god, this
job needs a Computer Science degree to do it. It is way too complicated.

There should be simpler ways.

Perhaps I don't need a package.

I just need to be able to call my "clearscreen" function from all of my
other scripts...

Where do I put my "clearscreen" function?

Is there a command similar to "include" in C++?

Is there a path management that I can call "clearscreen" function from
anywhere as long as its in path?


On 3/11/06, Gavin Simpson <[hidden email]> wrote:

>
> On Fri, 2006-03-10 at 22:50 -0800, Michael wrote:
> > Great! It worked! Thank you so much!
> >
> > Now since it worked greatly, how can I put this function into my own
> library
> > or package, so later on I can call this function from my other scripts?
> >
> > Thanks a lot!
>
> Michael,
>
> Read the two manuals that cover writing functions and preparing
> *packages* of code, which come with R or get them here:
>
> http://cran.r-project.org/manuals.html
>
> "An Introduction to R" and "Writing R Extensions",
>
> After reading and digesting, if you still have questions then post them
> to the list. People here provide their time for free and it is not much
> to expect posters to try to help themselves out first - especially as
> the developers have gone to such great lengths to produce quality
> documentation that explains all of this.
>
> HTH
>
> G
>
> >
> >
> > On 3/10/06, jim holtman <[hidden email]> wrote:
> > >
> > >  The archives had the following in it:
> > >
> > >  [R] how to clear screen in R-console?
> > >
> > >    - *This message*: [ Message body<
> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70722.html#start>] [ More
> > >    options<
> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70722.html#options2>]
> > >    - *Related messages*: [ Next message<
> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70723.html>] [ Previous
> > >    message <http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70721.html>]
> [ In
> > >    reply to<http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70708.html>]
> [ Next
> > >    in thread<
> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70800.html>] [
> > >    Replies<
> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70722.html#replies>]
> > >
> > >  *From*: Gabor Grothendieck
> <ggrothendieck<ggrothendieck?Subject=Re:%20[R]%20how%20to%20clear%20screen%20in%20R-console?>>
> > >
> > > *Date*: Fri, 17 Feb 2006 12:36:51 -0500
> > >
> > > Here is a version that uses rcom instead of RDCOMClient.
> > > This has the advantage that rcom is on CRAN.
> > >
> > > cls <- function() {
> > >         require(rcom)
> > >         wsh <- comCreateObject("Wscript.Shell")
> > >         comInvoke(wsh, "SendKeys", "\014")
> > >         invisible(wsh)
> > > }
> > > cls() # test
> > >
> > > On 2/17/06, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
> > > *> Here is a translation of Norm Olsen's vbscript code into pure R. *
> > > *> This is intended for use with the Windows Rgui interface. *
> > >
> > >
> > >
> > >
> > >  On 3/10/06, Michael <[hidden email]> wrote:
> > >
> > > > something like "sprintf" in C?
> > >
> > > so I can do:
> > >
> > > print(sprintf("the correct result is %3.4f\n", myresult));
> > >
> > > -------
> > >
> > > Also, I am desperately looking for a "clear console screen"  function
> in
> > > R...
> > >
> > > thanks a lot!
> > >
> > >        [[alternative HTML version deleted]]
> > >
> > > ______________________________________________
> > > [hidden email] mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide!
> > > http://www.R-project.org/posting-guide.html<
> http://www.r-project.org/posting-guide.html>
> > >
> > >
> > >
> > >
> > > --
> > > Jim Holtman
> > > Cincinnati, OH
> > > +1 513 646 9390 (Cell)
> > > +1 513 247 0281 (Home)
> > >
> > > What the problem you are trying to solve?
> > >
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
> --
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
> Gavin Simpson                     [T] +44 (0)20 7679 5522
> ENSIS Research Fellow             [F] +44 (0)20 7679 7565
> ENSIS Ltd. & ECRC                 [E] gavin.simpsonATNOSPAMucl.ac.uk
> UCL Department of Geography       [W] http://www.ucl.ac.uk/~ucfagls/cv/
> 26 Bedford Way                    [W] http://www.ucl.ac.uk/~ucfagls/
> London.  WC1H 0AP.
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
>
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: is there a formatted output in R?

Hans-Peter Suter
2006/3/11, Michael <[hidden email]>:
> I just need to be able to call my "clearscreen" function from all of my
> other scripts...
> Where do I put my "clearscreen" function?
> Is there a command similar to "include" in C++?

You can put the clearscreen function in a file. Then just "source" it,
which - with my basic C know how - should be the same as include.

All sourced function will "disapear" if you clear the environment (rm(
list = ls())). So it's maybe a good idea to source the global
functions/files everytime before executing the other scripts.

Regards,
Hans-Peter

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: is there a formatted output in R?

LosemindL
In reply to this post by LosemindL
Very good idea! Thank you very much!

On 3/11/06, jim holtman <[hidden email]> wrote:

>
>  Instead of trying to create a 'package', I just put all my common
> functions in a text file which I read in at the beginning of a session.
>
> ?Rprofile
>
> Basically, I just put the functions in a file called '.Rprofile' in put
> startup directory to have it loaded at the beginning.
>
>
>  On 3/11/06, Michael <[hidden email]> wrote:
> >
> >  Thank you for your reminder!
> >
> > I think you don't have to tell me to read the document.
> >
> > I have done that many times already.
> >
> > My feeling after reading the "creating package" manual is that my god,
> > this job needs a Computer Science degree to do it. It is way too
> > complicated.
> >
> > There should be simpler ways.
> >
> > Perhaps I don't need a package.
> >
> > I just need to be able to call my "clearscreen" function from all of my
> > other scripts...
> >
> > Where do I put my "clearscreen" function?
> >
> > Is there a command similar to "include" in C++?
> >
> > Is there a path management that I can call "clearscreen" function from
> > anywhere as long as its in path?
> >
> >
> > On 3/11/06, Gavin Simpson <[hidden email] > wrote:
> > >
> > > On Fri, 2006-03-10 at 22:50 -0800, Michael wrote:
> > > > Great! It worked! Thank you so much!
> > > >
> > > > Now since it worked greatly, how can I put this function into my own
> > > library
> > > > or package, so later on I can call this function from my other
> > > scripts?
> > > >
> > > > Thanks a lot!
> > >
> > > Michael,
> > >
> > > Read the two manuals that cover writing functions and preparing
> > > *packages* of code, which come with R or get them here:
> > >
> > > http://cran.r-project.org/manuals.html
> > >
> > > "An Introduction to R" and "Writing R Extensions",
> > >
> > > After reading and digesting, if you still have questions then post
> > > them
> > > to the list. People here provide their time for free and it is not
> > > much
> > > to expect posters to try to help themselves out first - especially as
> > > the developers have gone to such great lengths to produce quality
> > > documentation that explains all of this.
> > >
> > > HTH
> > >
> > > G
> > >
> > > >
> > > >
> > > > On 3/10/06, jim holtman < [hidden email]> wrote:
> > > > >
> > > > >  The archives had the following in it:
> > > > >
> > > > >  [R] how to clear screen in R-console?
> > > > >
> > > > >    - *This message*: [ Message body<
> > > http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70722.html#start>] [
> > > More
> > > > >    options<http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70722.html#options2
> > > >]
> > > > >    - *Related messages*: [ Next message<http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70723.html >]
> > > [ Previous
> > > > >    message <http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70721.html>]
> > > [ In
> > > > >    reply to<http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70708.html>]
> > > [ Next
> > > > >    in thread<http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70800.html >]
> > > [
> > > > >    Replies<http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70722.html#replies
> > > >]
> > > > >
> > > > >  *From*: Gabor Grothendieck
> > > <ggrothendieck<ggrothendieck?Subject=Re:%20[R]%20how%20to%20clear%20screen%20in%20R-console?>>
> > >
> > > > >
> > > > > *Date*: Fri, 17 Feb 2006 12:36:51 -0500
> > > > >
> > > > > Here is a version that uses rcom instead of RDCOMClient.
> > > > > This has the advantage that rcom is on CRAN.
> > > > >
> > > > > cls <- function() {
> > > > >         require(rcom)
> > > > >         wsh <- comCreateObject("Wscript.Shell")
> > > > >         comInvoke(wsh, "SendKeys", "\014")
> > > > >         invisible(wsh)
> > > > > }
> > > > > cls() # test
> > > > >
> > > > > On 2/17/06, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
> > > > > *> Here is a translation of Norm Olsen's vbscript code into pure
> > > R. *
> > > > > *> This is intended for use with the Windows Rgui interface. *
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >  On 3/10/06, Michael <[hidden email] > wrote:
> > > > >
> > > > > > something like "sprintf" in C?
> > > > >
> > > > > so I can do:
> > > > >
> > > > > print(sprintf("the correct result is %3.4f\n", myresult));
> > > > >
> > > > > -------
> > > > >
> > > > > Also, I am desperately looking for a "clear console
> > > screen"  function in
> > > > > R...
> > > > >
> > > > > thanks a lot!
> > > > >
> > > > >        [[alternative HTML version deleted]]
> > > > >
> > > > > ______________________________________________
> > > > > [hidden email] mailing list
> > > > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > > > PLEASE do read the posting guide!
> > > > > http://www.R-project.org/posting-guide.html
> > > <http://www.r-project.org/posting-guide.html><http://www.r-project.org/posting-guide.html
> > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Jim Holtman
> > > > > Cincinnati, OH
> > > > > +1 513 646 9390 (Cell)
> > > > > +1 513 247 0281 (Home)
> > > > >
> > > > > What the problem you are trying to solve?
> > > > >
> > > >
> > > >       [[alternative HTML version deleted]]
> > > >
> > > > ______________________________________________
> > > > [hidden email] mailing list
> > > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > > PLEASE do read the posting guide!
> > > http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> > > --
> > >
> > > %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
> > > Gavin Simpson                     [T] +44 (0)20 7679 5522
> > > ENSIS Research Fellow             [F] +44 (0)20 7679 7565
> > > ENSIS Ltd. & ECRC                 [E] gavin.simpsonATNOSPAMucl.ac.uk<http://gavin.simpsonatnospamucl.ac.uk/>
> > > UCL Department of Geography       [W] http://www.ucl.ac.uk/~ucfagls/cv/
> > >
> > > 26 Bedford Way                    [W] http://www.ucl.ac.uk/~ucfagls/
> > > London.  WC1H 0AP.
> > >
> > > %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
> > >
> > >
> >
> >
>
>
>
> --
>
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390 (Cell)
> +1 513 247 0281 (Home)
>
> What the problem you are trying to solve?
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: is there a formatted output in R?

Liaw, Andy
In reply to this post by LosemindL
From: Michael
>
> Thank you for your reminder!
>
> I think you don't have to tell me to read the document.

I beg to differ.  I'd bet many here do feel you need to read the
documentations more carefully.
 
> I have done that many times already.
>
> My feeling after reading the "creating package" manual is
> that my god, this job needs a Computer Science degree to do
> it. It is way too complicated.

If an amateur like me can do it, I'm quite sure a CS degree is not needed.
How many packages available on CRAN do you think were created by those with
CS degrees?  How many in R Core do you think have CS degrees?

> There should be simpler ways.

There are, and this question has been asked and answered many times over on
this very list.  Please do learn to search the archive, as the posting guide
asks you to.

Andy
 

> Perhaps I don't need a package.
>
> I just need to be able to call my "clearscreen" function from
> all of my other scripts...
>
> Where do I put my "clearscreen" function?
>
> Is there a command similar to "include" in C++?
>
> Is there a path management that I can call "clearscreen"
> function from anywhere as long as its in path?
>
>
> On 3/11/06, Gavin Simpson <[hidden email]> wrote:
> >
> > On Fri, 2006-03-10 at 22:50 -0800, Michael wrote:
> > > Great! It worked! Thank you so much!
> > >
> > > Now since it worked greatly, how can I put this function
> into my own
> > library
> > > or package, so later on I can call this function from my other
> > > scripts?
> > >
> > > Thanks a lot!
> >
> > Michael,
> >
> > Read the two manuals that cover writing functions and preparing
> > *packages* of code, which come with R or get them here:
> >
> > http://cran.r-project.org/manuals.html
> >
> > "An Introduction to R" and "Writing R Extensions",
> >
> > After reading and digesting, if you still have questions then post
> > them to the list. People here provide their time for free and it is
> > not much to expect posters to try to help themselves out first -
> > especially as the developers have gone to such great lengths to
> > produce quality documentation that explains all of this.
> >
> > HTH
> >
> > G
> >
> > >
> > >
> > > On 3/10/06, jim holtman <[hidden email]> wrote:
> > > >
> > > >  The archives had the following in it:
> > > >
> > > >  [R] how to clear screen in R-console?
> > > >
> > > >    - *This message*: [ Message body<
> >
> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70722.html#start>] [
> > More
> > > >    options<
> >
> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70722.html#options2>]
> > > >    - *Related messages*: [ Next message<
> > http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70723.html>] [
> > Previous
> > > >    message
> > > > <http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70721.html>]
> > [ In
> > > >    reply
> > > > to<http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70708.html>]
> > [ Next
> > > >    in thread<
> > http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70800.html>] [
> > > >    Replies<
> > http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70722.html#replies>]
> > > >
> > > >  *From*: Gabor Grothendieck
> >
> <ggrothendieck<ggrothendieck?Subject=Re:%20[R]%20how%20to%20clear%20sc
> > reen%20in%20R-console?>>
> > > >
> > > > *Date*: Fri, 17 Feb 2006 12:36:51 -0500
> > > >
> > > > Here is a version that uses rcom instead of
> RDCOMClient. This has
> > > > the advantage that rcom is on CRAN.
> > > >
> > > > cls <- function() {
> > > >         require(rcom)
> > > >         wsh <- comCreateObject("Wscript.Shell")
> > > >         comInvoke(wsh, "SendKeys", "\014")
> > > >         invisible(wsh)
> > > > }
> > > > cls() # test
> > > >
> > > > On 2/17/06, Gabor Grothendieck <ggrothendieck at
> gmail.com> wrote:
> > > > *> Here is a translation of Norm Olsen's vbscript code
> into pure
> > > > R. * *> This is intended for use with the Windows Rgui
> interface.
> > > > *
> > > >
> > > >
> > > >
> > > >
> > > >  On 3/10/06, Michael <[hidden email]> wrote:
> > > >
> > > > > something like "sprintf" in C?
> > > >
> > > > so I can do:
> > > >
> > > > print(sprintf("the correct result is %3.4f\n", myresult));
> > > >
> > > > -------
> > > >
> > > > Also, I am desperately looking for a "clear console screen"  
> > > > function
> > in
> > > > R...
> > > >
> > > > thanks a lot!
> > > >
> > > >        [[alternative HTML version deleted]]
> > > >
> > > > ______________________________________________
> > > > [hidden email] mailing list
> > > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > > PLEASE do read the posting guide!
> > > > http://www.R-project.org/posting-guide.html<
> > http://www.r-project.org/posting-guide.html>
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Jim Holtman
> > > > Cincinnati, OH
> > > > +1 513 646 9390 (Cell)
> > > > +1 513 247 0281 (Home)
> > > >
> > > > What the problem you are trying to solve?
> > > >
> > >
> > >       [[alternative HTML version deleted]]
> > >
> > > ______________________________________________
> > > [hidden email] mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide!
> > http://www.R-project.org/posting-guide.html
> > --
> >
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~
> %~%~%~%~%
> > Gavin Simpson                     [T] +44 (0)20 7679 5522
> > ENSIS Research Fellow             [F] +44 (0)20 7679 7565
> > ENSIS Ltd. & ECRC                 [E] gavin.simpsonATNOSPAMucl.ac.uk
> > UCL Department of Geography       [W]
> http://www.ucl.ac.uk/~ucfagls/cv/
> > 26 Bedford Way                    [W] http://www.ucl.ac.uk/~ucfagls/
> > London.  WC1H 0AP.
> >
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~
> > %
> >
> >
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: is there a formatted output in R?

Robert Duval
Dear Andy and Michael,

Please stick to the posting guide of this list... i.e.

"Be tolerant. Rudeness is never warranted, but sometimes `read the
manual' is the appropriate response. Don't waste time discussing such
matters on the list."

Robert Duval

On 3/11/06, Liaw, Andy <[hidden email]> wrote:

> From: Michael
> >
> > Thank you for your reminder!
> >
> > I think you don't have to tell me to read the document.
>
> I beg to differ.  I'd bet many here do feel you need to read the
> documentations more carefully.
>
> > I have done that many times already.
> >
> > My feeling after reading the "creating package" manual is
> > that my god, this job needs a Computer Science degree to do
> > it. It is way too complicated.
>
> If an amateur like me can do it, I'm quite sure a CS degree is not needed.
> How many packages available on CRAN do you think were created by those with
> CS degrees?  How many in R Core do you think have CS degrees?
>
> > There should be simpler ways.
>
> There are, and this question has been asked and answered many times over on
> this very list.  Please do learn to search the archive, as the posting guide
> asks you to.
>
> Andy
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: is there a formatted output in R? [User functions]

Mike Prager
In reply to this post by LosemindL
There is a slightly easier way to make your own functions available.

1. Set up a directory for your R configuration.  I use d:\r\mhp.  Copy
.Rprofile, Rconsole, Rdevga there.

2. Set up a Windows environment variable R_USER pointing to that
directory.  For example: R_USER=d:\r\mhp

The point of the preceding is to set R to load the same .Rprofile each
time it starts.

3. Set up a separate directory for your own functions.  I use
d:\r\mhp\mhpmisc.

4. Put your own functions in the directory from step 3.  Open R there.  
Source the functions.  Save the workspace as .Rdata.

5. In your .Rprofile file, add a line like this:

attach("d:/R/MHP/MHPmisc/.RData")

Now your functions will be available from every instance of R you start
up.  If you have many functions, I have written an R script that
searches the current directory for all of them, clears the workspace,
sources them all, and saves the workspace.  Reply to me by email if you
want a copy.

I have been told by Gurus that my method is too complicated, but I find
it a lot simpler than creating a package.

...MHP



Michael wrote on 3/11/2006 1:33 PM:

> Thank you for your reminder!
>
> I think you don't have to tell me to read the document.
>
> I have done that many times already.
>
> My feeling after reading the "creating package" manual is that my god, this
> job needs a Computer Science degree to do it. It is way too complicated.
>
> There should be simpler ways.
>
> Perhaps I don't need a package.
>
> I just need to be able to call my "clearscreen" function from all of my
> other scripts...
>
> Where do I put my "clearscreen" function?
>
> Is there a command similar to "include" in C++?
>
> Is there a path management that I can call "clearscreen" function from
> anywhere as long as its in path?
>
>
> On 3/11/06, Gavin Simpson <[hidden email]> wrote:
>  
>> On Fri, 2006-03-10 at 22:50 -0800, Michael wrote:
>>    
>>> Great! It worked! Thank you so much!
>>>
>>> Now since it worked greatly, how can I put this function into my own
>>>      
>> library
>>    
>>> or package, so later on I can call this function from my other scripts?
>>>
>>> Thanks a lot!
>>>      
>> Michael,
>>
>> Read the two manuals that cover writing functions and preparing
>> *packages* of code, which come with R or get them here:
>>
>> http://cran.r-project.org/manuals.html
>>
>> "An Introduction to R" and "Writing R Extensions",
>>
>> After reading and digesting, if you still have questions then post them
>> to the list. People here provide their time for free and it is not much
>> to expect posters to try to help themselves out first - especially as
>> the developers have gone to such great lengths to produce quality
>> documentation that explains all of this.
>>
>> HTH
>>
>> G
>>
>>    
>>> On 3/10/06, jim holtman <[hidden email]> wrote:
>>>      
>>>>  The archives had the following in it:
>>>>
>>>>  [R] how to clear screen in R-console?
>>>>
>>>>    - *This message*: [ Message body<
>>>>        
>> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70722.html#start>] [ More
>>    
>>>>    options<
>>>>        
>> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70722.html#options2>]
>>    
>>>>    - *Related messages*: [ Next message<
>>>>        
>> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70723.html>] [ Previous
>>    
>>>>    message <http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70721.html>]
>>>>        
>> [ In
>>    
>>>>    reply to<http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70708.html>]
>>>>        
>> [ Next
>>    
>>>>    in thread<
>>>>        
>> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70800.html>] [
>>    
>>>>    Replies<
>>>>        
>> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70722.html#replies>]
>>    
>>>>  *From*: Gabor Grothendieck
>>>>        
>> <ggrothendieck<ggrothendieck?Subject=Re:%20[R]%20how%20to%20clear%20screen%20in%20R-console?>>
>>    
>>>> *Date*: Fri, 17 Feb 2006 12:36:51 -0500
>>>>
>>>> Here is a version that uses rcom instead of RDCOMClient.
>>>> This has the advantage that rcom is on CRAN.
>>>>
>>>> cls <- function() {
>>>>         require(rcom)
>>>>         wsh <- comCreateObject("Wscript.Shell")
>>>>         comInvoke(wsh, "SendKeys", "\014")
>>>>         invisible(wsh)
>>>> }
>>>> cls() # test
>>>>
>>>> On 2/17/06, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
>>>> *> Here is a translation of Norm Olsen's vbscript code into pure R. *
>>>> *> This is intended for use with the Windows Rgui interface. *
>>>>
>>>>
>>>>
>>>>
>>>>  On 3/10/06, Michael <[hidden email]> wrote:
>>>>
>>>>        
>>>>> something like "sprintf" in C?
>>>>>          
>>>> so I can do:
>>>>
>>>> print(sprintf("the correct result is %3.4f\n", myresult));
>>>>
>>>> -------
>>>>
>>>> Also, I am desperately looking for a "clear console screen"  function
>>>>        
>> in
>>    
>>>> R...
>>>>
>>>> thanks a lot!
>>>>
>>>>        [[alternative HTML version deleted]]
>>>>
>>>> ______________________________________________
>>>> [hidden email] mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide!
>>>> http://www.R-project.org/posting-guide.html<
>>>>        
>> http://www.r-project.org/posting-guide.html>
>>    
>>>>
>>>>
>>>> --
>>>> Jim Holtman
>>>> Cincinnati, OH
>>>> +1 513 646 9390 (Cell)
>>>> +1 513 247 0281 (Home)
>>>>
>>>> What the problem you are trying to solve?
>>>>
>>>>        
>>>       [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> [hidden email] mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide!
>>>      
>> http://www.R-project.org/posting-guide.html
>> --
>> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
>> Gavin Simpson                     [T] +44 (0)20 7679 5522
>> ENSIS Research Fellow             [F] +44 (0)20 7679 7565
>> ENSIS Ltd. & ECRC                 [E] gavin.simpsonATNOSPAMucl.ac.uk
>> UCL Department of Geography       [W] http://www.ucl.ac.uk/~ucfagls/cv/
>> 26 Bedford Way                    [W] http://www.ucl.ac.uk/~ucfagls/
>> London.  WC1H 0AP.
>> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
>>
>>
>>    
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>  

--
Michael H. Prager, Ph.D.
Population Dynamics Team
NOAA Center for Coastal Habitat and Fisheries Research
NMFS Southeast Fisheries Science Center
Beaufort, North Carolina  28516  USA
http://shrimp.ccfhrb.noaa.gov/~mprager/


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Loading...