R Users,

I am new to R and have tried to figure out how to automate this
process instead of using excel.  I have read in this dataframe into r
with read.table.  I need to reshape the data from the first table into
the format of the second table.

TractID StandID Species CruiseDate      DBHClass        TreesPerAcre
Carbon  Stand 1 Loblolly Pine          5/20/2010        10      1.2
Carbon  Stand 1 Loblolly Pine          5/20/2010        12      1.2
Carbon  Stand 1 Loblolly Pine          5/20/2010        14      0.61
Carbon  Stand 1 Loblolly Pine          5/20/2010        16      0.75
Carbon  Stand 1 Hard Hardwoods  5/20/2010       6               27.4
Carbon  Stand 1 Hard Hardwoods  5/20/2010       8       16.4
Carbon  Stand 1 Hard Hardwoods  5/20/2010       10      16.1
Carbon  Stand 1 Hard Hardwoods  5/20/2010       12      18.3
Carbon  Stand 1 Hard Hardwoods  5/20/2010       14      9.9

I want the TreesPerAcre number to be divided evenly (1.2/20) over the
tenth inch DBHClasses.  For example, A 10 inch DBHClass would range
from 9.1 to 11.0, the 12 inch class would be from 11.1 to 13.0, etc.
Any help will be greatly appreciated.

TractID StandID Species CruiseDate      DBHClass        TreesPerAcre
Carbon  Stand 1 Loblolly Pine   5/20/2010       9.1     0.06
Carbon  Stand 1 Loblolly Pine   5/20/2010       9.2     0.06
Carbon  Stand 1 Loblolly Pine   5/20/2010       9.3     0.06
Carbon  Stand 1 Loblolly Pine   5/20/2010       9.4     0.06
Carbon  Stand 1 Loblolly Pine   5/20/2010       9.5     0.06
Carbon  Stand 1 Loblolly Pine   5/20/2010       9.6     0.06
Carbon  Stand 1 Loblolly Pine   5/20/2010       9.7     0.06
Carbon  Stand 1 Loblolly Pine   5/20/2010       9.8     0.06
Carbon  Stand 1 Loblolly Pine   5/20/2010       9.9     0.06
Carbon  Stand 1 Loblolly Pine   5/20/2010       10.0    0.06
Carbon  Stand 1 Loblolly Pine   5/20/2010       10.1    0.06
Carbon  Stand 1 Loblolly Pine   5/20/2010       10.2            0.06
Carbon  Stand 1 Loblolly Pine   5/20/2010       10.3            0.06
Carbon  Stand 1 Loblolly Pine   5/20/2010       10.4            0.06
Carbon  Stand 1 Loblolly Pine   5/20/2010       10.5            0.06
Carbon  Stand 1 Loblolly Pine   5/20/2010       10.6            0.06
Carbon  Stand 1 Loblolly Pine   5/20/2010       10.7            0.06
Carbon  Stand 1 Loblolly Pine   5/20/2010       10.8            0.06
Carbon  Stand 1 Loblolly Pine   5/20/2010       10.9            0.06
Carbon  Stand 1 Loblolly Pine   5/20/2010       11.0            0.06
etc.

Information:
R  2.11.1
Windows 7

Thanks in advance,

Randy

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to