r - Retrieve x/y values from a hist() graph -


let's graph using following command:

hist(rnorm(100, mean = 100, sd = 40), breaks=7) 

how can retrieve x/y values graph? mean realize hist works in ranges, then, how can ranges , plotted y values of barplot?

i have tried simple as:

> hist(rnorm(100, mean = 100, sd = 40), breaks=7)$x [1] "rnorm(100, mean = 100, sd = 40)" 

but can see no luck.

i have seen post (retrieve y value density function of given x value), relates density function , answer seems approximate function.

something this

set.seed(99) foo <- hist(rnorm(100, mean = 100, sd = 40), breaks=7, plot =  false) foo # $breaks # [1] -50   0  50 100 150 200 #  # $counts # [1]  2 11 34 47  6 #  # $density # [1] 0.0004 0.0022 0.0068 0.0094 0.0012 #  # $mids # [1] -25  25  75 125 175 #  # $xname # [1] "rnorm(100, mean = 100, sd = 40)" #  # $equidist # [1] true #  # attr(,"class") # [1] "histogram" 

and "x" , "y"

foo$breaks # [1] -50   0  50 100 150 200 foo$counts # [1]  2 11 34 47  6 

or alternatively mids in place or breaks cf. marat talipov's's comment below.

foo$mids # [1] -25  25  75 125 175 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -