[R] filling a matrix with data
aw2471 at bristol.ac.uk
aw2471 at bristol.ac.uk
Thu Mar 16 16:32:15 CET 2006
Hi,
I've extracted netcdf data in R, and am trying to output it in a matrix
format. I can make the matrix, and I have the data, but I can't get the
matrix to include the data...
I'm not very experienced at using R, so please forgive the crudeness of
these codes...
# For the matrix
wind_dir_data<-matrix( NA, 17, 365 , byrow = FALSE )
wind_speed_data<-matrix( NA, 17, 365, byrow = FALSE )
# to put the data into the matrix
wind_dir_data[level, ]<-wind_dir_corrected
wind_speed_data[level, ]<-rwind
#This is the response from R: "Error in "[<-"(`*tmp*`, level, , value =
c(-0.889991788193583, -1.45999177545309, :
number of items to replace is not a multiple of replacement length"
If I try to call the data using wind_dir_data[1, ], i get a matrix full
of NA, so the data hasn't transferred.
Does anyone know what I'm doing wrong?
Many thanks,
Amy
More information about the R-help
mailing list