Learn R Programming

agridat (version 1.23)

walsh.cottonprice: Acres and price of cotton 1910-1943

Description

Acres and price of cotton 1910-1943

Arguments

Format

A data frame with 34 observations on the following 9 variables.

year

year, numeric 1910-1943

acres

acres of cototn (1000s)

cotton

price per pound (cents) in previous year

cottonseed

price per ton (dollars) in previous year

combined

cotton price/pound + 1.857 x cottonseed price/pound (cents)

index

price index, 1911-1914=100

adjcotton

adjusted cotton price per pound (cents) in previous year

adjcottonseed

adjusted cottonseed price per ton (dollars) in previous year

adjcombined

adjusted combined price/pound (cents)

Details

The 'index' is a price index for all farm commodities.

Examples

Run this code
if (FALSE) {

library(agridat)

data(walsh.cottonprice)
dat <- walsh.cottonprice

dat <- transform(dat, acres=acres/1000) # convert to million acres

percentchg <- function(x){ # percent change from previous to current
  ix <- 2:(nrow(dat))
  c(NA, (x[ix]-x[ix-1])/x[ix-1])
}

# Compare percent change in acres with percent change in previous price
# using constant dollars
dat <- transform(dat, chga = percentchg(acres), chgp = percentchg(adjcombined))

with(dat, cor(chga, chgp, use='pair')) # .501 correlation
libs(lattice)
xyplot(chga~chgp, dat, type=c('p','r'),
       main="walsh.cottonprice",
       xlab="Percent change in previous price", ylab="Percent change in acres")
}

Run the code above in your browser using DataLab