[R] Help in error : SAM function in library siggenes

Siew Leng TENG siewlengteng at yahoo.com
Thu Jan 29 10:03:56 CET 2004


Hi,

I had the following situation and I greatly appreciate
any advice.

SAM gave the following error  :

"Error in var(v) : missing observations in cov/cor"

when applied on a dataset. The error was traced to a
variance computation of a vector containing NA in
fudge() [a subroutine called by SAM()]. This vector is
a computational output in fudge() :

"cv[i] <- sqrt(var(v))/mean(v)"

The same error was encountered when SAM was applied to
other similar datasets. Would modifying the statement
to "var(v, na.rm=TRUE)" be a possibility?

Many thanks,
Siew Leng
R-1.8.1 on Windows XP Home Edition

Code snippets :
data <- matrix(runif(25, 0,1), nrow=5)
x <- 1 : 5
sam(data, x)




More information about the R-help mailing list