search for: mysourcefile

Displaying 2 results from an estimated 2 matches for "mysourcefile".

2009 Jun 03
1
Using constrOptim() function
...where beta is a vector of coefficients and x is a data frame (think of it as a matrix). I want to optimize the function myFunction() by ONLY changing beta, i.e. x stays constant, with 4 constraints. I have the following code (with a separate source file for the function): rm(list=ls()) source('mySourceFile') x=read.csv("myFile.csv",head=TRUE,sep=",") beta_i=c(1,1,1,1,1,1,-1) ui=rbind(c(1,0,0,0,0,0,0),c(0,1,0,0,0,0,0),c(0,0,1,0,0,0,0),c(0,0,0,0,0,0,-1)) ci=c(0,0,0,0) constrOptim(beta_i, myFunction, NULL, ui, ci, mu = 1e-04, control = list(), method = "Nelder-Mead",...
2010 Jul 16
1
Inserting and testing revised functions in a package
...nment object which is a snapshot of the code. From this environment, functions and methods can be inserted into the environment of the package in the current session. The insertion uses the trace() mechanism, so the original code can be restored. The one-step version is: insertSource("mySourceFile.R", package = "myPackage", functions = "foo") This is intended specially for those of us who own largish packages. (It proved useful in debugging itself, e.g.) You can use the other trace() mechanisms with it, with a little care, as well as debug() etc. For the moment...