Quantcast

Setting Number of Displayed Digits

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

Setting Number of Displayed Digits

Rich Shepard
   Some chemicals have concentrations at or below the method detection limit
(MDL; 'less-thans') of 0.005 mg/L. When I look at the data frame that is how
the concentration is displayed. But, when I ask for a summary() of that data
frame column only 0 is displayed.

   How can I adjust the number of digits displayed by functions such as
summary()?

Rich

______________________________________________
[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
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Setting Number of Displayed Digits

Duncan Murdoch-2
On 12-08-07 5:30 PM, Rich Shepard wrote:
>     Some chemicals have concentrations at or below the method detection limit
> (MDL; 'less-thans') of 0.005 mg/L. When I look at the data frame that is how
> the concentration is displayed. But, when I ask for a summary() of that data
> frame column only 0 is displayed.
>
>     How can I adjust the number of digits displayed by functions such as
> summary()?
>

See ?summary.

Duncan Murdoch

> Rich
>
> ______________________________________________
> [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
> and provide commented, minimal, self-contained, reproducible code.
>

______________________________________________
[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
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Setting Number of Displayed Digits

Rui Barradas
In reply to this post by Rich Shepard
Hello,

function summary.data.frame does have a 'digits' argument with a default
set to
max(3, getOption("digits")-3)

If you need more digits in your summary, call

summary(object, digits = getOption("digits"))

Hope this helps,

Rui Barradas

Em 07-08-2012 22:30, Rich Shepard escreveu:

>   Some chemicals have concentrations at or below the method detection
> limit
> (MDL; 'less-thans') of 0.005 mg/L. When I look at the data frame that
> is how
> the concentration is displayed. But, when I ask for a summary() of
> that data
> frame column only 0 is displayed.
>
>   How can I adjust the number of digits displayed by functions such as
> summary()?
>
> Rich
>
> ______________________________________________
> [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
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[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
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Setting Number of Displayed Digits

Michael Weylandt
In reply to this post by Rich Shepard
Can you provide a reproducible example: see, e.g., this site for how to do so:


http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

Incidentally, I don't believe I can replicate your problem:

> x <- data.frame(conc = sample(c(100, 1,2,3, 0.005, 0.0005, 0.00002), 250, TRUE))
> summary(x)
      conc
 Min.   :  0.00002
 1st Qu.:  0.00050
 Median :  1.00000
 Mean   : 14.88871
 3rd Qu.:  3.00000
 Max.   :100.00000

But perhaps you should set

options(digits = 10)

or so

Michael

On Tue, Aug 7, 2012 at 4:30 PM, Rich Shepard <[hidden email]> wrote:

>   Some chemicals have concentrations at or below the method detection limit
> (MDL; 'less-thans') of 0.005 mg/L. When I look at the data frame that is how
> the concentration is displayed. But, when I ask for a summary() of that data
> frame column only 0 is displayed.
>
>   How can I adjust the number of digits displayed by functions such as
> summary()?
>
> Rich
>
> ______________________________________________
> [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
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[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
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Setting Number of Displayed Digits

David Winsemius
In reply to this post by Rich Shepard

On Aug 7, 2012, at 2:30 PM, Rich Shepard wrote:

>  Some chemicals have concentrations at or below the method detection  
> limit
> (MDL; 'less-thans') of 0.005 mg/L. When I look at the data frame  
> that is how
> the concentration is displayed. But, when I ask for a summary() of  
> that data
> frame column only 0 is displayed.
>
>  How can I adjust the number of digits displayed by functions such as
> summary()?

Before you hit "Send" on a post you should check to see that you have  
included data and  code. Otherwise you are asking us to just guess at  
what you did.

--

David Winsemius, MD
Alameda, CA, USA

______________________________________________
[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
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Setting Number of Displayed Digits

arun kirshna
This post has NOT been accepted by the mailing list yet.
In reply to this post by Rich Shepard
HI,
formatC() may work for you.
 summary(x,digits=5)
#may not work here.

I tried this within a list.  For some of the list members, this is not working.
summary(list12[[5]],digits=max(7))
  # Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
  #  1.0     1.0     2.5     3.2     5.0     7.0

 formatC(summary(list12[[5]]),format="f",digits=7)
#     Min.   1st Qu.    Median      Mean   3rd Qu.      Max.
#1.0000000 1.0000000 2.5000000 3.2000000 5.0000000 7.0000000

A.K.



Loading...