[R] Printing standard notation and scientific notation in the same column of a dataframe
du|c@|m@ @end|ng |rom b|gpond@com
Fri Sep 28 07:41:48 CEST 2018
If you do not require the zeros to the right in the scientific notation
 5.2e-01 1.7e-01 3.0e-02 1.0e-20
 0.52 0.17 0.03 0.00
Then use format, formatC or sprintf for character conversions
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2350
From: R-help [mailto:r-help-bounces using r-project.org] On Behalf Of David
Sent: Friday, 28 September 2018 04:53
To: David Disabato
Cc: r-help using r-project.org
Subject: Re: [R] Printing standard notation and scientific notation in the
same column of a dataframe
> On Sep 27, 2018, at 9:35 AM, David Disabato <ddisab01 using gmail.com> wrote:
> Hi R-help,
> I was wondering if it was possible for a column of a dataframe to print
> some numbers in standard notation and some in scientific notation. Say my
> column of data (i.e., dat$x) has numbers between 0 and 1 with a few
> very close to 0. When using the "scipen" argument in "options," R seems to
> print all numbers of a column in scientific notation if one number in the
> column is a decimal with a starting digit smaller than the "scipen"
> argument. It is annoying that is changes ALL numbers in that column to
> scientific notation though. For example, I do want .00000000000000000001
> scientific notation, but I want .52 in standard form. Ideally, an example
> dataframe column would print as something like this:
> However, I cannot figure out how to do this. Any solutions people are
0.52 0.17 0.03 1e-20
> David J. Disabato, M.A.
> Clinical Psychology Doctoral Student
> George Mason University
> ddisabat using gmu.edu
> Email is not a secure form of communication as information and
> confidentiality cannot be guaranteed. Information provided in an email is
> not intended to be a professional service. In the case of a crisis or
> emergency situation, call 911.
> [[alternative HTML version deleted]]
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
Alameda, CA, USA
'Any technology distinguishable from magic is insufficiently advanced.'
-Gehm's Corollary to Clarke's Third Law
R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
More information about the R-help