Skip to content
Back to formatted view

Raw Message

Message-ID: <3FF97D8A.2000803@ntlworld.com>
Date: 2004-01-05T15:06:50Z
From: Samuel Kemp
Subject: corrupt data object/session???

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.