Learn R Programming

geostats (version 1.6)

sizefrequency: calculate the size-frequency distribution of things

Description

Count the number of items exceeding a certain size.

Usage

sizefrequency(dat, n = 10, log = TRUE)

Value

a data frame with two columns size and

frequency

Arguments

dat

a numerical vector

n

the number of sizes to evaluate

log

logical. If TRUE, uses a log spacing for the sizes at which the frequencies are evaluated

Examples

Run this code
data(Finland,package='geostats')
sf <- sizefrequency(Finland$area)
plot(frequency~size,data=sf,log='xy')
fit <- lm(log(frequency) ~ log(size),data=sf)
lines(x=sf$size,y=exp(predict(fit)))

Run the code above in your browser using DataLab