[R] Error: "non-numeric argument to binary operator"
ligges at statistik.tu-dortmund.de
Sun Jul 17 16:38:32 CEST 2011
On 14.07.2011 23:03, Anil acharya wrote:
> I am posting in the topic related to the "non-numeric argument to binary
> operator" as I got similar problem while running the netcdf code. I have
> attached the file with this post. It is a climate data from NOAA site. The code
> follows as:
> Conn42 = open.ncdf("188.8.131.52.184.108.40.206.nc");
We do not have that file.
> # read the time variable, which measures years, and
> # use the length of the vector to estimate the time span
> timeObj = get.var.ncdf(Conn42,"time");
> file42YrRangeDays = trunc(length(timeObj))
> # Process each file separately:
> # get attributes, read the rhum data cube,
> # extract the time series from the cube,
> # and rescale the time series vector
> scaleFact = att.get.ncdf(Conn42,"rhum","scale_factor")
> offset = att.get.ncdf(Conn42,"rhum","add_offset")
> rhumObj = get.var.ncdf(Conn42,"rhum");
> # the Relative Humidity data 'cube' has 4 dimensions:
> # latitudes (4), longitudes (3), pressure levels (1),
> # and time (days - several thousand)
> rhCube = array(rhumObj,dim = c(4,3,file42YrRangeDays))
> rh42Vec = (((rhCube[2,2,1:file42YrRangeDays]) * scaleFact) + offset)
> #(Here is the point where I got the error "Error in (rhCube[2, 2,
> 1:file24YrRangeDays]) * scaleFact : non-numeric argument to binary operator"
Since we do not have the data, we cannot know, but you really should
if one or more of these are actually non-numeric.
> I appreciate if anyone can help me out.
> Anil Acharya
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help