However, if the package is loaded within the function call, then everything
seems to be ok. ...?? Where am I going wrong?

###### code #########

library(Rsge)
library(nlme)

ncols <- 500
nrows <- 50
response <- runif(ncols,1,1000)
d <- matrix(data = runif(n=nrows*ncols,1,1000),
        ncol=ncols,
        nrow=nrows,
        dimnames=list(paste(sep="","R",1:nrows),paste(sep="","C",1:ncols)))

f2x <- sample(1:300,500,replace=T)

f1lme <- function(x,y,f2x){

### LOAD LIBRARY INSIDE FUNCTION ?!?
    library(nlme)
    lmex <- lme(y~x, random = ~1|factor(f2x))
    return(lmex)
}

### Single node and sge
re  <- apply(d,1,f1lme,y=response,f2x)
rep <- sge.parRapply(d, f1lme,y=response,f2x, njobs = 3, join.method=c)


############### output ####

> re  <- apply(d,1,f1lme,y=response,f2x)

> rep <- sge.parRapply(d, f1lme,y=response,f2x, njobs = 3, join.method=c)
Completed storing environment to disk
Submitting  3 jobs...
All jobs completed
>
>



On Wed, Apr 6, 2011 at 1:32 PM, Brian Smith <bsmith030465@gmail.com> wrote:

> Hi,
>
> I was trying some of the tests with Rsge. I get an error, and I'm not sure
> I understand why. It works ok for a single node, but gives errors when
> multiple nodes are involved. Any help/comments would be appreciated!
>
> ############ code block ###########
> ###### r hpc sig
> library(Rsge)
> library(nlme)
>
> ncols <- 500
> nrows <- 50
> response <- runif(ncols,1,1000)
> d <- matrix(data = runif(n=nrows*ncols,1,1000),
>         ncol=ncols,
>         nrow=nrows,
>         dimnames=list(paste(sep="","R",1:nrows),paste(sep="","C",1:ncols)))
>
> f2x <- as.factor(sample(1:300,500,replace=T))
>
> f1lme <- function(x,y,f2x){
>     lmex <- lme(y~x, random = ~1|factor(f2x))
>     return(lmex)
> }
>
> ### Single node and sge
> re    <- apply(d,1,f1lme,y=response,f2x)
> rep <- sge.parRapply(d, f1lme,y=response,f2x, njobs = 3, join.method=c)
>
> ############# end code block #########
>
> This gives the following error:
>
> > re    <- apply(d,1,f1lme,y=response,f2x)
> > rep <- sge.parRapply(d, f1lme,y=response,f2x, njobs = 3, join.method=c)
> Completed storing environment to disk
> Submitting  3 jobs...
> All jobs completed
> Error in FUN(newX[, i], ...) : could not find function "lme"
> Error in FUN(newX[, i], ...) : could not find function "lme"
> Error in FUN(newX[, i], ...) : could not find function "lme"
> [1] "Not running join method since there are errors"
>
> =========================== sessionInfo =============
> > sessionInfo()
> R version 2.11.1 (2010-05-31)
> x86_64-unknown-linux-gnu
>
> locale:
>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>  [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8
>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
>  [9] LC_ADDRESS=C               LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] nlme_3.1-98 Rsge_0.6.3  snow_0.3-3
>
> loaded via a namespace (and not attached):
> [1] grid_2.11.1    lattice_0.18-8
> >
>

	[[alternative HTML version deleted]]

