[R] Restricted Domain Optimization Problem

2012-11-13 Thread McGehee, Robert
Hello, I'm hoping for some help implementing a general optimization problem in R. I'd like to write a program that for a vector of non-negative input values, x, returns a non-negative normalized vector y such that sum(y)==1, and y = maxx (vector of maximum values), and for which sum((x-y)^2) is

[R] Find exit status inside on.exit

2012-02-10 Thread McGehee, Robert
Hello, Does anyone know if it is possible to find out whether a calling function exited with an error or not inside of an on.exit() call? I'd like to use the same error cleanup function inside of several functions, and for aesthetic reasons would prefer not to surround the body of all of these

[R] regexpr help (match.length=0)

2010-06-01 Thread McGehee, Robert
R-help, Sorry if this is more of a regex question than an R question. However, help would be appreciated on my use of the regexpr function. In the first example below, I ask for all characters (a-z) in 'abc123'; regexpr returns a 3-character match beginning at the first character.

[R] match and incomparables

2008-09-12 Thread McGehee, Robert
Hello, I was playing around with the newly implemented 'incomparables' argument in 'match' and realized the argument does not behave anything like I expected. Can someone explain what is going on here? Sorry if I'm misreading the documentation. match(1:3, 1:3, incomparables=1) [1] NA 2 3 #

[R] A Maze Generator

2008-04-29 Thread McGehee, Robert
I had some fun this afternoon coding up a 'maze generator' in R. I thought I'd pass along the fruits of my labor for everyone's amusement. As written, every point is connected to every other point, so feel free to 'start' and 'finish' anywhere you like. Have fun! --Robert PS. Feel free to pass

Re: [R] A Maze Generator

2008-04-29 Thread McGehee, Robert
, April 29, 2008 5:34 PM To: McGehee, Robert Cc: r-help Subject: Re: [R] A Maze Generator McGehee, Robert wrote: I had some fun this afternoon coding up a 'maze generator' in R. I thought I'd pass along the fruits of my labor for everyone's amusement. As written, every point is connected to every

[R] time zone conversion

2008-04-28 Thread McGehee, Robert
Hello, I'm trying to convert times in the EST/EDT (New York) format to times in the GMT/BST (London) and UTC+9 format (Tokyo). That is, if I know what time it is in New York, what is local time in London and Tokyo? Ex: Here's the conversion from New York EST/EDT time to London's GMT/BST time

Re: [R] time zone conversion

2008-04-28 Thread McGehee, Robert
) -Original Message- From: McGehee, Robert Sent: Monday, April 28, 2008 4:27 PM To: r-help Subject: time zone conversion Hello, I'm trying to convert times in the EST/EDT (New York) format to times in the GMT/BST (London) and UTC+9 format (Tokyo). That is, if I know what time