Hi,

I have written the following R function.....

GT <- function(data, p)
{
    if(!is.loaded(symbol.C("runGT")))

dyn.load("/home/sekemp/Documents/RFiles/GammaProject/Test/GammaImproved2.so")
dim <- length(data)
M <- length(data[,dim])
reconstruct <- array(dim=c(M,dim))
for(i in 1:(dim-1))
{
reconstruct[,i] <- data[,i]
}
outputs <- array(data[,dim])
inputs <- array(as.matrix(dist(reconstruct, method="euclidean", diag=TRUE, upper=TRUE)), dim=c(M,M))
overall <- .C("runGT",
as.double(inputs),
as.double(outputs),
as.integer(M),
as.integer(p),
rd = double(p),
rg = double(p))
deltas <- overall$rd
gammas <- overall$rg
GT <- data.frame(deltas, gammas)
return(GT)
}


When I use the function it returns the correct results. However, when I call the function for a second (3rd, 4th, etc) time it runs OK but does not return the correct result.

I am using R on the latest version of Red Hat Linux.

Does anyone have any ideas on a fix for this problem????

Cheers,

Sam.

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to