-
- if (length(vector1)==1)
- {
- #If there is only one element
- h$breaks<-c(vector1,vector1)
- h$counts<-1
- }
- else
- {
- if (type=="mean")
- #Mean value only
- h$breaks<-c(mean(vector1),mean(vector1))
- h$counts<-length(vector1)
- else
- if (type=="default")
- #Standard HISTOGRAM:
- h<-hist(vector1)
- else
- {
- #Dhist:
- h<-dhist(vector1,nbins=type, plot = FALSE, lab.spikes = FALSE, a=5*iqr(vector1), eps=0.15)
- h$breaks<-h$xbr
- h$count<-as.vector(h$counts)
- h$counts<-h$count
- h<-merge_empty_bins(h)
- }
- }
+ if (length(vector1)==1){
+ #If there is only one element
+ h<-hist(vector1) # Just for R compatibility reasons
+ h$breaks<-c(vector1,vector1)
+ h$counts<-1
+ } else {
+ if (type=="mean"){
+ #Mean value only
+ h<-hist(vector1) # Just for R compatibility reasons
+ h$breaks<-c(mean(vector1),mean(vector1))
+ h$counts<-length(vector1)
+ } else
+ if (type=="default")
+ #Standard HISTOGRAM:
+ h<-hist(vector1)
+ else {
+ #Dhist:
+ h<-dhist(vector1,nbins=type, plot = FALSE, lab.spikes = FALSE, a=5*iqr(vector1), eps=0.15)
+ h$breaks<-h$xbr
+ h$count<-as.vector(h$counts)
+ h$counts<-h$count
+ h<-merge_empty_bins(h)
+ }
+ }