[ADMB Users] running admb from R using system()

Mark Maunder mmaunder at iattc.org
Mon May 31 09:08:40 PDT 2010


Try this

   if (.Platform$OS.type == "windows") {
        shell(paste(exedr, file_name, 
            ".exe", " ", cmdoptions, sep = ""), invisible = TRUE)
    }
    else {
        system(paste("cp ", exedr, 
            file_name, " .", sep = ""))
        system(paste("./", file_name, " ", cmdoptions, sep = ""))
        unlink(file_name)
    }


 
Mark Maunder 
Head of the Stock Assessment Program
Inter-American  Tropical Tuna Commission
8604 La Jolla Shores Drive
La Jolla, CA, 92037-1508, USA
  
Tel: (858) 546-7027
Fax: (858) 546-7133
mmaunder at iattc.org
http://www.fisheriesstockassessment.com/TikiWiki/tiki-index.php?page=Mar
k+Maunder
 
Visit the AD Model Builder project at
 http://admb-project.org/
 
See the following website for information on fisheries stock assessment
http://www.fisheriesstockassessment.com/
 
-----Original Message-----
From: users-bounces at admb-project.org
[mailto:users-bounces at admb-project.org] On Behalf Of Benedikt Gehr
Sent: Monday, May 31, 2010 1:44 AM
To: users at admb-project.org
Subject: [ADMB Users] running admb from R using system()

Hi

I'm trying to run an admb model from R by using the system () command.
The admb model runs fine when running it from the admb command line or
when using emacs. However when I try it with system() then R crashes
every time.
And I tried using the R command line and RGui and in both it crashes. I
also tried it from different computers.

What I do is I first set the directory where I keep the admb template
file with the corresponding admb data file and then invoke the system
command either step by step or directly. I can build the model but when
executing the model.exe file R crashes.

##########################
#setting the working directory
setwd("Documents and Settings\\Beni User\\Desktop\\Transfer\\Model
Fournier\\admb models\\simulated data\\stochastic\\pooled age classes")

#building the model -> this works fine
system('makeadm stocpool')

#running the model -> makes R crash
system('stoc.exe')
###########################
#or directly like this:
setwd("Documents and Settings\\Beni User\\Desktop\\Transfer\\Model
Fournier\\admb models\\simulated data\\stochastic\\pooled age classes")
system("./stocpool") -> makes R crash right away


Does anyone know why this happens and how I can make this work?

Thanks a lot for the help!!

cheers

Beni





_______________________________________________
Users mailing list
Users at admb-project.org
http://lists.admb-project.org/mailman/listinfo/users



More information about the Users mailing list