[R] numeric format
jim holtman
jholtman at gmail.com
Tue Feb 26 22:47:39 CET 2008
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, digits=4)
a
1 0.713705
2 0.715497
3 0.629579
4 0.184361
5 0.456639
6 0.008667
7 0.260985
8 0.270916
9 0.689129
10 0.302484
>
On 2/26/08, cvandy <cvandy26 at gmail.com> wrote:
>
> 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. Also, it prints an unwanted index number (1-20) in the left column.
> How do I get rid of the index column and how do I control the number of
> decimal places?
> Thanks in advance.
> CHV
> --
> View this message in context: http://www.nabble.com/numeric-format-tp15700452p15700452.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org 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.
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem you are trying to solve? Tell me what you want to
do, not how you want to do it.
More information about the R-help
mailing list