line numbers

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

line numbers

Pogoda, Wendy
I am using the sink function to save several results (i.e. values of many different variables) to an output file.  However, the output looks unattractive because it displays line numbers next to each new variable, it is difficult to remove the R variable name from the output, and I cannot print test without it using quotation marks.  The only way I have found around most of these issues is to create a data.frame such as:
 
data.frame("Minimum BMD"=c(minimumBMD,minimumBMD.time,paste(100*(1-Climit.level),"%"),

minimumBMD.ConfidenceLimit,

if(CI.2sided)paste(minimumBMD.ConfidenceLimit.upper),paste(100*alpha.BMR,"%")),

row.names=c("Minimum BMD",time.name,"Confidence Level","BMDL (Lower Conf. Limit)",

if(CI.2sided)paste("BMDU (Upper Conf. Limit)"),"BMR Level"))

However, the output will look like:
                                Minimum.BMD
Minimum BMD              0.0280273960783465
Test Time                             28.56
Confidence Level                       95 %
BMDL (Lower Conf. Limit) 0.0178262627224170
BMR Level                               5 %
 
and I would rather not have the words "Minimum.BMD" in there at all.  Plus I would like to add addition lines of text and other values.  Is there a way I can format the output attractively?  I know this must be possible because many functions (e.g. summary(lm(y~x))) will display output nicely and include text.
 
Thank you for your time.  If you would like to e-mail me directly, my e-mail address is [hidden email].

        [[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
|

Re: line numbers

Gabor Grothendieck
Check out ?sprintf, ?cat, ?noquote, ?format, ?formatC, ?print.

Also maybe ?sub, ?gsub, ?chartr, ?grep.

To view the code that prints summary(lm(...whatever...)), put this on
a line by itself:

  stats:::print.summary.lm

The summary statement mentioned above outputs an object of
class "summary.lm" and the S3 method to print summary.lm
objects is called print.summary.lm and that is contained in the
stats namespace.

On 1/29/06, Pogoda, Wendy <[hidden email]> wrote:

> I am using the sink function to save several results (i.e. values of many different variables) to an output file.  However, the output looks unattractive because it displays line numbers next to each new variable, it is difficult to remove the R variable name from the output, and I cannot print test without it using quotation marks.  The only way I have found around most of these issues is to create a data.frame such as:
>
> data.frame("Minimum BMD"=c(minimumBMD,minimumBMD.time,paste(100*(1-Climit.level),"%"),
>
> minimumBMD.ConfidenceLimit,
>
> if(CI.2sided)paste(minimumBMD.ConfidenceLimit.upper),paste(100*alpha.BMR,"%")),
>
> row.names=c("Minimum BMD",time.name,"Confidence Level","BMDL (Lower Conf. Limit)",
>
> if(CI.2sided)paste("BMDU (Upper Conf. Limit)"),"BMR Level"))
>
> However, the output will look like:
>                                Minimum.BMD
> Minimum BMD              0.0280273960783465
> Test Time                             28.56
> Confidence Level                       95 %
> BMDL (Lower Conf. Limit) 0.0178262627224170
> BMR Level                               5 %
>
> and I would rather not have the words "Minimum.BMD" in there at all.  Plus I would like to add addition lines of text and other values.  Is there a way I can format the output attractively?  I know this must be possible because many functions (e.g. summary(lm(y~x))) will display output nicely and include text.
>
> Thank you for your time.  If you would like to e-mail me directly, my e-mail address is [hidden email].
>
>        [[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