[R] Bar charts, frequencies known, intervals of varying width

Jim Lemon jim at bitwrit.com.au
Thu Nov 24 08:38:03 CET 2011


On 11/24/2011 02:50 AM, scriptham2 wrote:
> Hi
>
> I would like to plot bar charts in a particular way. The intervals are not
> evenly distributed and are in a data frame column called size and the
> relative frequencies are in a second column called mass. Both size and mass
> are continuous ratio data to all intents and purposes. The data actually
> represents sieving of sand where $size is sieve aperture and where $mass is
> the amount remaining on the sieve.
>
> So if I sieve 100g of sand through increasingly fine sieves nothing remains
> on the coarsest sieve say 2500 microns. Between 2000 and 2500 microns there
> is 0.2g remining on the 2000micron sieve etc. as per the data supplied.
>
> size, mass
> 2500, 0
> 2000, 0.2
> 1700, 1.8
> 1400, 5
> 1000, 13
> 800, 40
> 600, 20
> 300, 15
> 180, 3
> <180, 2
>
> The data here I have made up for simplicity. In general sands tend to be
> distributed as lognormal curves and mixtures of sands are combined as the
> mixture of 2 or more lognormal distributions.
>
> I would like to fit 2, 3 or preferably 4 parameter log normal distributions
> and plot these cumulative distributions on the charts.
>
> The problems are: I can't seem to find how to do the bar charts in R...

sands<-read.csv("sands.csv")
library(plotrix)
barp(sands$mass,names.arg=sands$size,staxx=TRUE)

Jim



More information about the R-help mailing list