Re: [R] recovering from errors with lapply()

2013-02-13 Thread Andrew Barr
Thanks very much Milan. Your answer makes perfect sense. Best, Andrew On Wed, Feb 13, 2013 at 3:51 AM, Milan Bouchet-Valat nalimi...@club.frwrote: Le mardi 12 février 2013 à 15:41 -0600, Andrew Barr a écrit : Hi all, I am searching for a way to recover results from lapply() when one

[R] recovering from errors with lapply()

2013-02-12 Thread Andrew Barr
Hi all, I am searching for a way to recover results from lapply() when one or more values returns an error. I have a written a function that uses tryCatch() to recover from errors. Here is a very simple example of such a function. divideBy2-function(X){ result-tryCatch(X/2, error =

[R] Assigning value to a vector from within a function

2010-10-06 Thread Andrew Barr
. Andrew Barr [[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 provide commented, minimal, self

[R] help me avoid nested for() loops!

2009-11-20 Thread Andrew Barr
,1],point.array.indices[i,2],points[j,1],points[j,2])) } } This is obviously prohibitively slow with 1 rows in the array. Any thoughts on how to do this without for loops? I apologize in advance if there is an obvious way around this. Thanks! Andrew Barr University of Texas at Austin

[R] isolate elements in vector that match one of many possible values

2008-09-08 Thread Andrew Barr
of values of interest is really long. Is there a nicer way to do this? Something akin to the MySQL construction in(), as in #MySQL script example Select * from table where parameter in(x,y,z); Thanks! -- W. Andrew Barr Biological Anthropology University of Texas at Austin [[alternative

[R] using complete.cases() with nested factors

2008-09-04 Thread Andrew Barr
Hello, This maybe a newbie question. I have a dataframe that looks like the sample at the bottom of the email. I have monthly precipitation data from several sites over several years. For each site, I need to extract years that have a complete series of 12 monthly precipitation values, while