Hi,
Here is an implementation:
> data <- read.table("tree.txt",header=TRUE,sep=",",stringsAsFactors=FALSE)
> data
treecode yearrw d
1 TC149 2014NA8
2 TC149 2013 0.080 NA
3 TC149 2012 0.125 NA
4 TC149 2011 0.120 NA
5 TC149 2010 0.125 NA
6 T
that calculates using preceding records
Hi:
Here's another way. If I understand this correctly, you can get the diameters
by setting the NA values in d to zero, taking the cumulative sum of d (within
treecode) and then subtracting the result from diam[1]. Since I'm used to doing
th
0, 2015 3:30 PM
> To: r-help@r-project.org
> Subject: [R] function that calculates using preceding records
>
> Greetings:
>
>
>
> My dataframe has 4 variables: treecode, year, rw (tree ring width),
> and d (tree diameter). The d variable
>
> only has data for 2014.
> To: r-help@r-project.org
> Subject: [R] function that calculates using preceding records
>
> Greetings:
>
>
>
> My dataframe has 4 variables: treecode, year, rw (tree ring width), and
> d (tree diameter). The d variable
>
> only has data for 2014. I wish to calculat
Greetings:
My dataframe has 4 variables: treecode, year, rw (tree ring width), and d
(tree diameter). The d variable
only has data for 2014. I wish to calculate earlier diameters by subtracting
each year's growth (rw) from the
previous year's diameter, by treecode. Can anyone help me with a
5 matches
Mail list logo