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.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to