Re: [R] numeric format

2008-02-27 Thread Mike Prager
Rolf Turner [EMAIL PROTECTED] wrote: I have often wanted to suppress these row numbers and for that purpose wrote the following version of print.data.frame() [...] The ``srn'' argument means ``suppress row numbers''; [...] I once suggested to an R Core person that my version of

[R] numeric format

2008-02-26 Thread cvandy
Hi! I'm an R newbie and this should be a trivial problem, but I can't make it work and cannot find what I'm doing wrong in the literature. I entered the the command: table-data.frame(x, scientific=F, digits=4) table This prints a column of x with 16 useless decimal places after the decimal point.

Re: [R] numeric format

2008-02-26 Thread Erik Iverson
Without knowing what your 'x' is, it's hard to see what is happening that you don't like. Your data.frame function creates a data.frame containing columns scientific and digits, equal to FALSE and 4 for all rows, respectively. Is that what you want? cvandy wrote: Hi! I'm an R newbie and

Re: [R] numeric format

2008-02-26 Thread jim holtman
Those are parameter to 'print'; what you want is something like: x - data.frame(a=runif(10)) print(x) a 1 0.713705394 2 0.715496609 3 0.629578524 4 0.184360667 5 0.456639418 6 0.008667156 7 0.260985437 8 0.270915631 9 0.689128652 10 0.302484280 print(x,scientific=F,

Re: [R] numeric format

2008-02-26 Thread John Kane
Can you give a working example of what is happening and explain what is x? With a simple x vector of x - rnorm(20, 5, 2) I don't get anything like what you seem to be getting. My code === x - rnorm(20, 5, 2) table-data.frame(x, scientific=F,

Re: [R] numeric format

2008-02-26 Thread Rolf Turner
On 27/02/2008, at 11:01 AM, John Kane wrote: Can you give a working example of what is happening and explain what is x? With a simple x vector of x - rnorm(20, 5, 2) I don't get anything like what you seem to be getting. My code === x -

Re: [R] numeric format

2008-02-26 Thread cvandy
Thanks, Erik, This is a partial copy of my code. I want to get rid of the left column of integers and I want to control the number of decimal places after the decimal point. j-0.4 for(i in 1:20){ + j=j+0.1;cp[i]-pnorm(-j*3)*10^6;ratio[i]-j} table-data.frame(ratio,cp) table ratio

Re: [R] numeric format

2008-02-26 Thread Don MacQueen
While we're at it, and since you're new... Your example will be much easier for r-help folks to read if you do it like this: j - 0.4 for(i in 1:20) { j=j+0.1 cp[i] - pnorm(-j*3)*10^6 ratio[i] - j } table - data.frame(ratio,cp) table But the loop is unnecessary. Try j - seq(0.5,