[R] Extracting values from an array

Petr Klasterecky klaster at karlin.mff.cuni.cz
Fri Apr 27 07:37:25 CEST 2007


power.output[wind.speed, air.density]

assuming power.output is your matrix, wind.speed a vector with speeds 
and air.density another vector with air densities you want.

Petr

Met Man napsal(a):
> I have an array with dimension of 5001 (rows) by 40 (columns).  This array is
> a series of power output from a wind turbine in kW.  The rows correspond to
> wind speed from 0 to 50 m/s in 0.01 m/s step increments.  The columns
> correspond to the air density values from 0.90 to 1.30 kg/m3 in 0.01 kg/m3
> step increments.  I have a vector of wind speed and air density observations
> (typically 8760 records for a year).  Given the wind speed and air density,
> I want to select the proper wind turbine power output.  I've been trying to
> figure this out, but am having a major brain fart.  I can do this in a for (
> i in 1 : N  ) { } loop, but that is very, very inefficient.  Can anyone
> suggest a simple, efficient way to do this in R?  Thanks.
> 
>  

-- 
Petr Klasterecky
Dept. of Probability and Statistics
Charles University in Prague
Czech Republic



More information about the R-help mailing list