s-news
[Top] [All Lists]

Coercing to character

To: s-news@wubios.wustl.edu
Subject: Coercing to character
From: asanquer@virbac.fr
Date: Tue, 6 Sep 2005 14:33:39 +0200



Hi,

I've got a problem when I coerce a numeric value to a character: I loose
some decimal digits after the decimal point.

Example:

> x <- c(3.45,3.40)
> as.character(x)
[1] "3.45" "3.4"

I really want to keep the 2 decimal digits. Does someone can give me a
tip-off?

I had also noted that when I export some data frame to an ASCII file, I
loose the null decimal digit (with numeric data). An explanation and may be
a solution?

Thank a lot,

Annaële Sanquer


<Prev in Thread] Current Thread [Next in Thread>