1

I have imported a csv file with one column and its values.

a <- read.csv("/home/file.csv")     

Now I want a histogram with frequencies of the values

h <- hist(as.matrix(a))  

text(h$mids,h$counts,labels=h$counts, adj=c(0.5,-0.5))  

What does the function adj=c(0.5,-0.5) exactly?

x <- seq(8,13, 1)   
-> that's the first and end value (8,13)  

curve(dnorm(x, mean=mean(a$weight), sd=sd(a$weight)), add=T)    

Now I have the curve, but not the frequencies of the values anymore.

I also tried it with: h <- hist(as.matrix(a), prob=T)

And I can't set the ylab and xlab h <- hist(as.matrix(a), xlab="..", ylab=".." ) it takes default labs.

demongolem
  • 9,474
  • 36
  • 90
  • 105
Eronimo
  • 23
  • 5
  • As to *"what does `adj=c(0.5,-0.5)` [do] exactly?"*, have a look at the documentation in `?text` that explains the `adj` argument. Then try experimenting with a few different values for `adj`. If you're still confused, ask a separate question. – Gregor Thomas Jan 25 '17 at 16:32
  • As to the rest of the question, [is this what you're trying to do? *Overlay normal curve to histogram in R.*](http://stackoverflow.com/q/20078107/903061) – Gregor Thomas Jan 25 '17 at 16:33
  • Sounds like you might want to fit a model (e.g. linear) first – David C. Jan 26 '17 at 03:09

0 Answers0