Converting scientific notation range values for frequency plots

Print Fixed Numeric Notation – To print values in fixed numeric notation instead of scientific notation use the command:

options(scipen=999)  # positive integer for scipen.  negative for showing scientific notation.

 

This example is for demonstrating the usage of the dig.lab parameter for setting the number of digits to display for the frequency ranges.  Removing the dig.lab parameter will default the ranges listed in scientific notation.  In this case the range numbers are set to 4 digits. e.g. [7000, 7300)

A <- read.csv(“Altitudes.csv”, header=FALSE, stringsAsFactors=FALSE)  #import data
A                                                                     #view A
Altitudes<-A[[1]]                                                     #extract Altitudes
range(Altitudes)                                  #identify range of data;
breaks=seq(7000,9100,by=300)                      #break data into 7 classes with width = 300
breaks                                            #view breaks
A.cut<- cut(Altitudes,breaks,right=”False”, dig.lab=4)       #assign observations to classes
A.cut
A.freq<-table(A.cut)                              #make frequency counts
A.freq                                            #view frequency distribution
cbind(A.freq)

Leave a Reply

Your email address will not be published. Required fields are marked *