[R] Help/ Mathematics

David Winsemius dwinsemius at comcast.net
Thu Jun 22 02:33:17 CEST 2017


> On Jun 21, 2017, at 11:19 AM, Ahmed Attia <ahmedatia80 at gmail.com> wrote:
> 
> Hi R users,
> 
> I need your help to write a code in r that does the following
> calculation from three different datasets;
> 
> ac = 1/sum (NPP from date 1 to date 2, dataset=1) * (biomass at date 2
> -biomass at date 1, dataset = 2) + (littfall at date 2, dataset=3).

To do this in R you could learn to use the "sqldf"-package since you seem familiar with that syntax. I'm not and so it's rank speculation on my part that such an expression would be meaningful in one or another flavor of SQL.

Or you could use either `match` or `merge`, assuming the dates of the various datasets are congruent.


> 
> all the dates are in yr-month-day format.

The "YYYY-MM-DD" format is the standard format in R. You might not even need to convert to the Date-class.


> Which library or function
> Should I use to tell R do these calculations of these variables at
> different dates.
> 
> I appreciate your help.
> 
> Ahmed Attia, Ph.D.
> Agronomist & Soil Scientist
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list