I'm trying to calculate some volumes using R. Imagine I have the following data:
h=seq(from=663,by=0.1,length.out=11); #Vector of reference heights Ap=0.25; #Discretization area z=c(NA,NA,NA,663.05,663.13,663.25,663.33,663.45,663.67,663.84,663.9,664.39,NA,NA,NA); #Elevation of every element in the surface
What I want is to generate a vector returning a Riemann sum, computing the product
Ap*(h-z) for every element in
Does anyone know how this can be achieved using R?
I have tried using
sapply(), but I haven't been successful so far.
Thank you in advance for any help!