もう 1 つの解決策は、ビニングされたデータをデータ フレームに保存し、そのデータ フレームを CSV ファイルまたはその他の形式で Excel にエクスポートすることです。
> x <- rnorm(1000)
> h <- hist(x)
> h
$breaks
[1] -3.5 -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0
$counts
[1] 1 5 23 38 104 154 208 191 130 85 39 17 4 0 1
$density
[1] 0.002 0.010 0.046 0.076 0.208 0.308 0.416 0.382 0.260 0.170 0.078 0.034 0.008 0.000 0.002
$mids
[1] -3.25 -2.75 -2.25 -1.75 -1.25 -0.75 -0.25 0.25 0.75 1.25 1.75 2.25 2.75 3.25 3.75
$xname
[1] "x"
$equidist
[1] TRUE
attr(,"class")
[1] "histogram"
> out <- data.frame(mid = h$mids, counts = h$counts)
> write.table(out, file = "export.csv", row.names = FALSE, sep = ",")
必要に応じて密度をエクスポートすることもできます。