[R] R2admb compile problem

Allan Clark allan.clark at uct.ac.za
Sun Oct 20 12:12:07 CEST 2013


Good morning all

I am trying to use R2admb and have the following very simple example. The *.tpl is included below. I am a Windows 7 user, using R3.01.

//Function1.tpl
//*********************************
PARAMETER_SECTION
 init_number x;
 objective_function_value C;

PROCEDURE_SECTION
 C=  pow(x-5,2);
//*********************************

I am running the example using three different methods
1. from DOS
2. From Emacs
3. From within R


1. from DOS
admb Function1
Function1

This runs correctly and works

2. From Emacs

I "Translate", "Build" and "Run" the file and it works correctly

3. From R

#Using the following code

require(R2admb)

fn="Function1"
setup_admb()  #outputs the following [1] "c:\\ADMB\\admb101-gcc452-win64"
compile_admb(fn, verbose=T)
#I set 'verbose =T' to see whats happening
#last error line = 'collect2: ld returned 1 exit status'

#cant run this part of the code
run_admb(fn)

#Error in run_admb(fn) :
#executable Function1.exe not found: did you forget to compile it?


Note that if I first compile the tpl file using DOS and then run the following from R, that everything works.

run_admb(fn) #to run the executable
results <- read_admb(fn)
results
clean_admb(fn)


DOES ANYONE KNOW WHY compile_admb(fn, verbose=T) DOES NOT WORK CORRECTLY?


//Function1.tpl
DATA_SECTION

PARAMETER_SECTION
 init_number x;
 objective_function_value C;


PRELIMINARY_CALCS_SECTION

PROCEDURE_SECTION

 C=  pow(x-5,2);
________________________________
 UNIVERSITY OF CAPE TOWN

This e-mail is subject to the UCT ICT policies and e-mai...{{dropped:9}}



More information about the R-help mailing list