[R] Extracting Variable Name to define breaks for histogram

Christian Langkamp christian.langkamp at basf.com
Wed Feb 4 18:07:59 CET 2009


Hi

I am trying to define an automatic breaks function for a histogram.
Inputs are a vector x and a number n. What I would like is to define the
outcome as breaks_(Name of Vector) - but the paste("breaks_",x) obviously
refers to the whole vector. 

breaks<- function(x, n)
{
R<-range(x, na.rm=T)
diff_x<-R[2]-R[1]
paste("breaks_",x)<-c(NA, seq(floor(R[1]), ceiling(R[2]),diff_x/n))
rm(diff_x, R)
}
-- 
View this message in context: http://www.nabble.com/Extracting-Variable-Name-to-define-breaks-for-histogram-tp21834903p21834903.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list