Re: [R] numeric format

From: John Kane <jrkrideau_at_yahoo.ca>
Date: Tue, 26 Feb 2008 17:01:42 -0500 (EST)


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, digits=4) table

The numbers on the left are simply line numbers that are automatically printed when you are printing a dataframe to the screen. I don't see any way to supress them for a simple command such as your table

You might want to have a look at print and print.default to address the digits problem

By the way, table is a reserved word in R and probably should not be used as a name for a data.frame.

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



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. Received on Tue 26 Feb 2008 - 22:04:35 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 26 Feb 2008 - 22:30:17 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive