[R] corrupt data object/session???
Samuel Kemp
sam.kemp2 at ntlworld.com
Mon Jan 5 16:06:50 CET 2004
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.
More information about the R-help
mailing list