Re: [R] Script auto-detecting its own path

2010-09-29 Thread Stu Field
d which would return something like: [1] "c:/user/Desktop/" so that regardless of where the script is, as long as the accompanying scripts are in the same directory, they can be easily sourced with something like: dirX <- file.path.is.here("MasterScript.r") source(paste(dir

[R] Script auto-detecting its own path

2010-09-29 Thread Stu Field
ype the path every time I move it). Any ideas? Stu ps. I found this on the internet but a) I couldn't understand it, and b) it didn't work: frame_files <- lapply(sys.frames(), function(x) x$ofile) frame_files <- Filter(Negate(is.null), frame_files) P

Re: [R] Confusing concept of vector and matrix in R

2010-04-26 Thread Stu
Hi all, One subtlety is that the drop argument only works if you specify 2 or more indices e.g. [i, j, ..., drop=F]; but not for a single index e.g [i, drop=F]. Why doesn't R complain about the unused "drop=F" argument in the single index case? Cheers, - Stu a = matrix(1:10, nro

Re: [R] how can one break or stop or return from a script?

2009-11-17 Thread Stu
Thanks ... It's good to know I'm not missing the obvious. - Stu On Nov 16, 8:31 pm, Don MacQueen wrote: > I don't know how to do this in the way you describe. > > Easy alternatives include: > >   - putting the part of the script that is to be executed > condit

[R] how can one break or stop or return from a script?

2009-11-16 Thread Stu
--- #hack to enable setting of breakpoint repeat { ... if (condition) { break; } ... # remember to break !! break; } #end repeat EOF Thanks, - Stu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

[R] Curve fit a nonlinear equation with box constraints: success, many thanks!

2009-06-17 Thread Stu @ AGS
Dear R Helper Community! Thank you for all your help and suggestions. For your reference and any future person searching the archives, here is the solution that did what I wanted it to do. As background, my goal was to find the coefficients for the following equation form: y ~ c1 * x1 *

[R] Specifying ui and ci such that ui %*% theta - ci >= 0

2009-06-17 Thread Stu @ AGS
rect for these constraints. I have already solved the problem in another statistics package so I know the actual solution to the coefficients. But our ultimate goal is to do additional work in R. But so far, I have been unable to recreate our solution in R. T

[R] Constrained Optimization, a full example

2009-06-16 Thread Stu @ AGS
(apparently). Any suggestions appreciated. Thanks Stu # data y <- c(0.111,0.0921052631578947,0.0564516129032258,0.0608108108108108 ,0.0128205128205128,0.0136078431372549); x1 <- c(0,0.978723404255319,0.087378640776699,0.549295774647887,0.0596026490066225 ,0.615789473

[R] ui and ci explanatory documentation

2009-06-16 Thread Stu @ AGS
argument of the function call) are constrained to be between 2 values? If no additional documents exist, then that would be good to know also. Any pointer or advice would be useful. Thank you! Stu Original posting* by <http://www.nabble.com/u

[R] The R-Inferno

2009-06-16 Thread Stu @ AGS
Patrick, Thanks for your suggestion! The R-Inferno was especially useful!! The first chapter had me chuckling aloud despite the fact that I work alone. Well worth the price! Thanks! Stu > -Original Message- > From: Patrick Burns [mailto:pbu...@pburns.sean

Re: [R] Trouble with optim on a specific problem

2009-06-16 Thread Stu @ AGS
nonlinear optimization problem with linear constraints on the regression parameters. Thanks Stu > -Original Message- > From: Liviu Andronic [mailto:landronim...@gmail.com] > Sent: Tuesday, June 16, 2009 12:15 PM > Cc: r-help@r-project.org > Subject: Re: [R] Trouble with optim on a s

[R] The most straightfoward way to write a function that sums over the rows of a matrix

2009-06-16 Thread Stu @ AGS
What am I missing? Thanks Stu [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and p

Re: [R] Trouble with optim on a specific problem

2009-06-16 Thread Stu @ AGS
319, 0.087378640776699, 0.549295774647887, 0.0596026490066225, 0.61578947368421) Thank you again, Stu > -Original Message- > From: Liviu Andronic [mailto:landronim...@gmail.com] > Sent: Tuesday, June 16, 2009 2:35 AM > To: Stu @ AGS > Cc: r-help@r-project.org > Subject: Re: [R]

[R] Trouble with optim on a specific problem

2009-06-15 Thread Stu @ AGS
optim(c(0.66, 0.999, 0.064), pe, NULL, method = "CG") : objective function in optim evaluates to length 6 not 1 I don't know what the error message should mean to me. Particulars for the problem are listed below. Thanks in advance for any help!! Stu > y <- c(0

[R] Linear Regression with Constraints

2009-05-26 Thread Stu @ AGS
c3 < 1.0 y, x1, x2, and x3 are observed data. I have a total of 6 rows of data in a data set. Is "optim" in the stats package the right function to use? Also, I can't quite figure out how to specify the constraints. Thank you! -Stu

Re: [R] Matrix Construction; Subdiagonal

2009-03-11 Thread Stu Field
Thanks Bill, This one will work perfectly, the others required an existing matrix to be modified, which isn't the case (I'm using this xyz function in a larger construct). Plus it's only a 12x12, so not too big on memory. Thank you! Stu On 11 • Mar • 2009, at 6:34 PM, wrot

Re: [R] Matrix Construction; Subdiagonal

2009-03-11 Thread Stu Field
Sure, that'll work fine, thanks. But I guess I was looking for something more similar to MatLab, I'm really surprised R doesn't have a preset command for this (?) Thanks again, Stu On 11 • Mar • 2009, at 5:49 PM, Sundar Dorai-Raj wrote: > > Does this help? > > A <

[R] Matrix Construction; Subdiagonal

2009-03-11 Thread Stu Field
elieve there is not a simple way to do this... Thanks for your help, ~~~~~~ Stu Field, PhD Postdoctoral Fellow Department of Biology Colorado State University 1878 Campus Delivery Fort Collins, CO 80523-1878 Office: E208 Anatomy/Zoology Phone:

[R] Error running OC package - program ending

2007-11-09 Thread Stu Bioge
I am attempting to run Poole's OC package in R, using Windows NT 5.1. Everytime I try to estimate a two-dimensional model, the estimation begins and then I am informed "R for Windows GUI front-end has encountered a problem and needs to close". There is no problem estimating a one-dimensional mod