To Try or to TryCatch, I have tried to long

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

To Try or to TryCatch, I have tried to long

Josh R.
So after about 4 hours struggling with Try and TryCatch I am throwing in the towel.  I have a more complicated function that used logspline through iterative distributions and at some point the logspline doesnt function correctly for some subsets but is fine with others so I need to be able to identify when the error occurs and stop curtailing the distribution and I think this Try or TryCatch should do the trick but I think I am missing something here. A simple example


result_<-list()
for(i in 1:10){
          if(inherits(try(sqrt(9-i),silent=TRUE),"try-error")){
                #If sqrt fails
                result_[[i]]<-0 } else {
                #If sqrt succeeds
                result_[[i]] <- 1 }
}


I would expect this to fail only when i > 9 but succeeds  each time.  DO i need to specify something different where "try-error" resides?  Thanks guys

Cheers,
 Josh
Reply | Threaded
Open this post in threaded view
|

Re: To Try or to TryCatch, I have tried to long

Gene Leynes
I think the problem is that it's only a warning and not an error.

result_<-list()
for(i in 1:10){
     if(inherits(try(sqrt(9-i),silent=TRUE),"try-error")){
     #If sqrt fails
     cat('fail',i,'\n')
     result_[[i]]<-0 } else {
     #If sqrt succeeds
     cat('succeed',i,'\n')
     result_[[i]] <- 1 }
}
result_

On Tue, Dec 6, 2011 at 11:11 AM, LCOG1 <[hidden email]> wrote:

> So after about 4 hours struggling with Try and TryCatch I am throwing in
> the
> towel.  I have a more complicated function that used logspline through
> iterative distributions and at some point the logspline doesnt function
> correctly for some subsets but is fine with others so I need to be able to
> identify when the error occurs and stop curtailing the distribution and I
> think this Try or TryCatch should do the trick but I think I am missing
> something here. A simple example
>
>
> result_<-list()
> for(i in 1:10){
>          if(inherits(try(sqrt(9-i),silent=TRUE),"try-error")){
>                #If sqrt fails
>                result_[[i]]<-0 } else {
>                #If sqrt succeeds
>                result_[[i]] <- 1 }
> }
>
>
> I would expect this to fail only when i > 9 but succeeds  each time.  DO i
> need to specify something different where "try-error" resides?  Thanks guys
>
> Cheers,
>  Josh
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/To-Try-or-to-TryCatch-I-have-tried-to-long-tp4165578p4165578.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] 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-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: To Try or to TryCatch, I have tried to long

Gene Leynes
I've had the same problem in other cases.

Does anyone know how to catch warnings as well as errors?

On Tue, Dec 6, 2011 at 12:34 PM, ROLL Josh F <[hidden email]> wrote:

> **
> Agreed.  But what I am trying to control is when I get a warning.  I want
> to do something different if a warning OR an error pop up?  Any ideas?
>
> Cheers
>
>  ------------------------------
> *From:* [hidden email] [mailto:[hidden email]] *On Behalf Of *Gene
> Leynes
> *Sent:* Tuesday, December 06, 2011 10:27 AM
> *To:* ROLL Josh F
> *Cc:* [hidden email]
> *Subject:* Re: [R] To Try or to TryCatch, I have tried to long
>
> I think the problem is that it's only a warning and not an error.
>
> result_<-list()
> for(i in 1:10){
>      if(inherits(try(sqrt(9-i),silent=TRUE),"try-error")){
>      #If sqrt fails
>      cat('fail',i,'\n')
>      result_[[i]]<-0 } else {
>      #If sqrt succeeds
>      cat('succeed',i,'\n')
>      result_[[i]] <- 1 }
> }
> result_
>
> On Tue, Dec 6, 2011 at 11:11 AM, LCOG1 <[hidden email]> wrote:
>
>> So after about 4 hours struggling with Try and TryCatch I am throwing in
>> the
>> towel.  I have a more complicated function that used logspline through
>> iterative distributions and at some point the logspline doesnt function
>> correctly for some subsets but is fine with others so I need to be able to
>> identify when the error occurs and stop curtailing the distribution and I
>> think this Try or TryCatch should do the trick but I think I am missing
>> something here. A simple example
>>
>>
>> result_<-list()
>> for(i in 1:10){
>>          if(inherits(try(sqrt(9-i),silent=TRUE),"try-error")){
>>                #If sqrt fails
>>                result_[[i]]<-0 } else {
>>                #If sqrt succeeds
>>                result_[[i]] <- 1 }
>> }
>>
>>
>> I would expect this to fail only when i > 9 but succeeds  each time.  DO i
>> need to specify something different where "try-error" resides?  Thanks
>> guys
>>
>> Cheers,
>>  Josh
>>
>>
>> --
>> View this message in context:
>> http://r.789695.n4.nabble.com/To-Try-or-to-TryCatch-I-have-tried-to-long-tp4165578p4165578.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> [hidden email] 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-contained, reproducible code.
>>
>
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: To Try or to TryCatch, I have tried to long

William Dunlap
Look at the archives of this mailing list for a discussion
entitled 'Stack trace?' on Nov 9-10 of this year.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com

> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf Of Gene Leynes
> Sent: Tuesday, December 06, 2011 10:58 AM
> To: ROLL Josh F
> Cc: [hidden email]
> Subject: Re: [R] To Try or to TryCatch, I have tried to long
>
> I've had the same problem in other cases.
>
> Does anyone know how to catch warnings as well as errors?
>
> On Tue, Dec 6, 2011 at 12:34 PM, ROLL Josh F <[hidden email]> wrote:
>
> > **
> > Agreed.  But what I am trying to control is when I get a warning.  I want
> > to do something different if a warning OR an error pop up?  Any ideas?
> >
> > Cheers
> >
> >  ------------------------------
> > *From:* [hidden email] [mailto:[hidden email]] *On Behalf Of *Gene
> > Leynes
> > *Sent:* Tuesday, December 06, 2011 10:27 AM
> > *To:* ROLL Josh F
> > *Cc:* [hidden email]
> > *Subject:* Re: [R] To Try or to TryCatch, I have tried to long
> >
> > I think the problem is that it's only a warning and not an error.
> >
> > result_<-list()
> > for(i in 1:10){
> >      if(inherits(try(sqrt(9-i),silent=TRUE),"try-error")){
> >      #If sqrt fails
> >      cat('fail',i,'\n')
> >      result_[[i]]<-0 } else {
> >      #If sqrt succeeds
> >      cat('succeed',i,'\n')
> >      result_[[i]] <- 1 }
> > }
> > result_
> >
> > On Tue, Dec 6, 2011 at 11:11 AM, LCOG1 <[hidden email]> wrote:
> >
> >> So after about 4 hours struggling with Try and TryCatch I am throwing in
> >> the
> >> towel.  I have a more complicated function that used logspline through
> >> iterative distributions and at some point the logspline doesnt function
> >> correctly for some subsets but is fine with others so I need to be able to
> >> identify when the error occurs and stop curtailing the distribution and I
> >> think this Try or TryCatch should do the trick but I think I am missing
> >> something here. A simple example
> >>
> >>
> >> result_<-list()
> >> for(i in 1:10){
> >>          if(inherits(try(sqrt(9-i),silent=TRUE),"try-error")){
> >>                #If sqrt fails
> >>                result_[[i]]<-0 } else {
> >>                #If sqrt succeeds
> >>                result_[[i]] <- 1 }
> >> }
> >>
> >>
> >> I would expect this to fail only when i > 9 but succeeds  each time.  DO i
> >> need to specify something different where "try-error" resides?  Thanks
> >> guys
> >>
> >> Cheers,
> >>  Josh
> >>
> >>
> >> --
> >> View this message in context:
> >> http://r.789695.n4.nabble.com/To-Try-or-to-TryCatch-I-have-tried-to-long-tp4165578p4165578.html
> >> Sent from the R help mailing list archive at Nabble.com.
> >>
> >> ______________________________________________
> >> [hidden email] 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-contained, reproducible code.
> >>
> >
> >
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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-contained, reproducible code.

______________________________________________
[hidden email] 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-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: To Try or to TryCatch, I have tried to long

William Dunlap
Or, Google for 'R catching warnings' and third entry is the excellent
  http://www.stats.uwo.ca/faculty/murdoch/software/debuggingR/

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com

> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf Of William Dunlap
> Sent: Tuesday, December 06, 2011 11:38 AM
> To: [hidden email]; ROLL Josh F
> Cc: [hidden email]
> Subject: Re: [R] To Try or to TryCatch, I have tried to long
>
> Look at the archives of this mailing list for a discussion
> entitled 'Stack trace?' on Nov 9-10 of this year.
>
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
>
> > -----Original Message-----
> > From: [hidden email] [mailto:[hidden email]] On Behalf Of Gene Leynes
> > Sent: Tuesday, December 06, 2011 10:58 AM
> > To: ROLL Josh F
> > Cc: [hidden email]
> > Subject: Re: [R] To Try or to TryCatch, I have tried to long
> >
> > I've had the same problem in other cases.
> >
> > Does anyone know how to catch warnings as well as errors?
> >
> > On Tue, Dec 6, 2011 at 12:34 PM, ROLL Josh F <[hidden email]> wrote:
> >
> > > **
> > > Agreed.  But what I am trying to control is when I get a warning.  I want
> > > to do something different if a warning OR an error pop up?  Any ideas?
> > >
> > > Cheers
> > >
> > >  ------------------------------
> > > *From:* [hidden email] [mailto:[hidden email]] *On Behalf Of *Gene
> > > Leynes
> > > *Sent:* Tuesday, December 06, 2011 10:27 AM
> > > *To:* ROLL Josh F
> > > *Cc:* [hidden email]
> > > *Subject:* Re: [R] To Try or to TryCatch, I have tried to long
> > >
> > > I think the problem is that it's only a warning and not an error.
> > >
> > > result_<-list()
> > > for(i in 1:10){
> > >      if(inherits(try(sqrt(9-i),silent=TRUE),"try-error")){
> > >      #If sqrt fails
> > >      cat('fail',i,'\n')
> > >      result_[[i]]<-0 } else {
> > >      #If sqrt succeeds
> > >      cat('succeed',i,'\n')
> > >      result_[[i]] <- 1 }
> > > }
> > > result_
> > >
> > > On Tue, Dec 6, 2011 at 11:11 AM, LCOG1 <[hidden email]> wrote:
> > >
> > >> So after about 4 hours struggling with Try and TryCatch I am throwing in
> > >> the
> > >> towel.  I have a more complicated function that used logspline through
> > >> iterative distributions and at some point the logspline doesnt function
> > >> correctly for some subsets but is fine with others so I need to be able to
> > >> identify when the error occurs and stop curtailing the distribution and I
> > >> think this Try or TryCatch should do the trick but I think I am missing
> > >> something here. A simple example
> > >>
> > >>
> > >> result_<-list()
> > >> for(i in 1:10){
> > >>          if(inherits(try(sqrt(9-i),silent=TRUE),"try-error")){
> > >>                #If sqrt fails
> > >>                result_[[i]]<-0 } else {
> > >>                #If sqrt succeeds
> > >>                result_[[i]] <- 1 }
> > >> }
> > >>
> > >>
> > >> I would expect this to fail only when i > 9 but succeeds  each time.  DO i
> > >> need to specify something different where "try-error" resides?  Thanks
> > >> guys
> > >>
> > >> Cheers,
> > >>  Josh
> > >>
> > >>
> > >> --
> > >> View this message in context:
> > >> http://r.789695.n4.nabble.com/To-Try-or-to-TryCatch-I-have-tried-to-long-tp4165578p4165578.html
> > >> Sent from the R help mailing list archive at Nabble.com.
> > >>
> > >> ______________________________________________
> > >> [hidden email] 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-contained, reproducible code.
> > >>
> > >
> > >
> >
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] 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-contained, reproducible code.
>
> ______________________________________________
> [hidden email] 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-contained, reproducible code.

______________________________________________
[hidden email] 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-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: To Try or to TryCatch, I have tried to long

Josh R.
 Thank for the links.  I reread one I found yesterday about changing the options parameter to options(warn = 2) and that allows the try() function to see a warning the same way as an error so problem solved using the existing code.  

Cheers,
 Josh

-----Original Message-----
From: William Dunlap [mailto:[hidden email]]
Sent: Tuesday, December 06, 2011 11:42 AM
To: [hidden email]; ROLL Josh F
Cc: [hidden email]
Subject: RE: [R] To Try or to TryCatch, I have tried to long

Or, Google for 'R catching warnings' and third entry is the excellent
  http://www.stats.uwo.ca/faculty/murdoch/software/debuggingR/

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of William Dunlap
> Sent: Tuesday, December 06, 2011 11:38 AM
> To: [hidden email]; ROLL Josh F
> Cc: [hidden email]
> Subject: Re: [R] To Try or to TryCatch, I have tried to long
>
> Look at the archives of this mailing list for a discussion entitled
> 'Stack trace?' on Nov 9-10 of this year.
>
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
>
> > -----Original Message-----
> > From: [hidden email]
> > [mailto:[hidden email]] On Behalf Of Gene Leynes
> > Sent: Tuesday, December 06, 2011 10:58 AM
> > To: ROLL Josh F
> > Cc: [hidden email]
> > Subject: Re: [R] To Try or to TryCatch, I have tried to long
> >
> > I've had the same problem in other cases.
> >
> > Does anyone know how to catch warnings as well as errors?
> >
> > On Tue, Dec 6, 2011 at 12:34 PM, ROLL Josh F <[hidden email]> wrote:
> >
> > > **
> > > Agreed.  But what I am trying to control is when I get a warning.  
> > > I want to do something different if a warning OR an error pop up?  Any ideas?
> > >
> > > Cheers
> > >
> > >  ------------------------------
> > > *From:* [hidden email] [mailto:[hidden email]] *On Behalf Of
> > > *Gene Leynes
> > > *Sent:* Tuesday, December 06, 2011 10:27 AM
> > > *To:* ROLL Josh F
> > > *Cc:* [hidden email]
> > > *Subject:* Re: [R] To Try or to TryCatch, I have tried to long
> > >
> > > I think the problem is that it's only a warning and not an error.
> > >
> > > result_<-list()
> > > for(i in 1:10){
> > >      if(inherits(try(sqrt(9-i),silent=TRUE),"try-error")){
> > >      #If sqrt fails
> > >      cat('fail',i,'\n')
> > >      result_[[i]]<-0 } else {
> > >      #If sqrt succeeds
> > >      cat('succeed',i,'\n')
> > >      result_[[i]] <- 1 }
> > > }
> > > result_
> > >
> > > On Tue, Dec 6, 2011 at 11:11 AM, LCOG1 <[hidden email]> wrote:
> > >
> > >> So after about 4 hours struggling with Try and TryCatch I am
> > >> throwing in the towel.  I have a more complicated function that
> > >> used logspline through iterative distributions and at some point
> > >> the logspline doesnt function correctly for some subsets but is
> > >> fine with others so I need to be able to identify when the error
> > >> occurs and stop curtailing the distribution and I think this Try
> > >> or TryCatch should do the trick but I think I am missing
> > >> something here. A simple example
> > >>
> > >>
> > >> result_<-list()
> > >> for(i in 1:10){
> > >>          if(inherits(try(sqrt(9-i),silent=TRUE),"try-error")){
> > >>                #If sqrt fails
> > >>                result_[[i]]<-0 } else {
> > >>                #If sqrt succeeds
> > >>                result_[[i]] <- 1 } }
> > >>
> > >>
> > >> I would expect this to fail only when i > 9 but succeeds  each time.  DO i
> > >> need to specify something different where "try-error" resides?  Thanks
> > >> guys
> > >>
> > >> Cheers,
> > >>  Josh
> > >>
> > >>
> > >> --
> > >> View this message in context:
> > >> http://r.789695.n4.nabble.com/To-Try-or-to-TryCatch-I-have-tried-to-long-tp4165578p4165578.html
> > >> Sent from the R help mailing list archive at Nabble.com.
> > >>
> > >> ______________________________________________
> > >> [hidden email] 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-contained, reproducible code.
> > >>
> > >
> > >
> >
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] 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-contained, reproducible code.
>
> ______________________________________________
> [hidden email] 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-contained, reproducible code.

______________________________________________
[hidden email] 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-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: To Try or to TryCatch, I have tried to long

Michael Weylandt
This also might be of help:

http://mazamascience.com/WorkingWithData/?p=912

Michael

On Tue, Dec 6, 2011 at 3:02 PM, ROLL Josh F <[hidden email]> wrote:

>  Thank for the links.  I reread one I found yesterday about changing the options parameter to options(warn = 2) and that allows the try() function to see a warning the same way as an error so problem solved using the existing code.
>
> Cheers,
>  Josh
>
> -----Original Message-----
> From: William Dunlap [mailto:[hidden email]]
> Sent: Tuesday, December 06, 2011 11:42 AM
> To: [hidden email]; ROLL Josh F
> Cc: [hidden email]
> Subject: RE: [R] To Try or to TryCatch, I have tried to long
>
> Or, Google for 'R catching warnings' and third entry is the excellent
>  http://www.stats.uwo.ca/faculty/murdoch/software/debuggingR/
>
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
>
>> -----Original Message-----
>> From: [hidden email]
>> [mailto:[hidden email]] On Behalf Of William Dunlap
>> Sent: Tuesday, December 06, 2011 11:38 AM
>> To: [hidden email]; ROLL Josh F
>> Cc: [hidden email]
>> Subject: Re: [R] To Try or to TryCatch, I have tried to long
>>
>> Look at the archives of this mailing list for a discussion entitled
>> 'Stack trace?' on Nov 9-10 of this year.
>>
>> Bill Dunlap
>> Spotfire, TIBCO Software
>> wdunlap tibco.com
>>
>> > -----Original Message-----
>> > From: [hidden email]
>> > [mailto:[hidden email]] On Behalf Of Gene Leynes
>> > Sent: Tuesday, December 06, 2011 10:58 AM
>> > To: ROLL Josh F
>> > Cc: [hidden email]
>> > Subject: Re: [R] To Try or to TryCatch, I have tried to long
>> >
>> > I've had the same problem in other cases.
>> >
>> > Does anyone know how to catch warnings as well as errors?
>> >
>> > On Tue, Dec 6, 2011 at 12:34 PM, ROLL Josh F <[hidden email]> wrote:
>> >
>> > > **
>> > > Agreed.  But what I am trying to control is when I get a warning.
>> > > I want to do something different if a warning OR an error pop up?  Any ideas?
>> > >
>> > > Cheers
>> > >
>> > >  ------------------------------
>> > > *From:* [hidden email] [mailto:[hidden email]] *On Behalf Of
>> > > *Gene Leynes
>> > > *Sent:* Tuesday, December 06, 2011 10:27 AM
>> > > *To:* ROLL Josh F
>> > > *Cc:* [hidden email]
>> > > *Subject:* Re: [R] To Try or to TryCatch, I have tried to long
>> > >
>> > > I think the problem is that it's only a warning and not an error.
>> > >
>> > > result_<-list()
>> > > for(i in 1:10){
>> > >      if(inherits(try(sqrt(9-i),silent=TRUE),"try-error")){
>> > >      #If sqrt fails
>> > >      cat('fail',i,'\n')
>> > >      result_[[i]]<-0 } else {
>> > >      #If sqrt succeeds
>> > >      cat('succeed',i,'\n')
>> > >      result_[[i]] <- 1 }
>> > > }
>> > > result_
>> > >
>> > > On Tue, Dec 6, 2011 at 11:11 AM, LCOG1 <[hidden email]> wrote:
>> > >
>> > >> So after about 4 hours struggling with Try and TryCatch I am
>> > >> throwing in the towel.  I have a more complicated function that
>> > >> used logspline through iterative distributions and at some point
>> > >> the logspline doesnt function correctly for some subsets but is
>> > >> fine with others so I need to be able to identify when the error
>> > >> occurs and stop curtailing the distribution and I think this Try
>> > >> or TryCatch should do the trick but I think I am missing
>> > >> something here. A simple example
>> > >>
>> > >>
>> > >> result_<-list()
>> > >> for(i in 1:10){
>> > >>          if(inherits(try(sqrt(9-i),silent=TRUE),"try-error")){
>> > >>                #If sqrt fails
>> > >>                result_[[i]]<-0 } else {
>> > >>                #If sqrt succeeds
>> > >>                result_[[i]] <- 1 } }
>> > >>
>> > >>
>> > >> I would expect this to fail only when i > 9 but succeeds  each time.  DO i
>> > >> need to specify something different where "try-error" resides?  Thanks
>> > >> guys
>> > >>
>> > >> Cheers,
>> > >>  Josh
>> > >>
>> > >>
>> > >> --
>> > >> View this message in context:
>> > >> http://r.789695.n4.nabble.com/To-Try-or-to-TryCatch-I-have-tried-to-long-tp4165578p4165578.html
>> > >> Sent from the R help mailing list archive at Nabble.com.
>> > >>
>> > >> ______________________________________________
>> > >> [hidden email] 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-contained, reproducible code.
>> > >>
>> > >
>> > >
>> >
>> >     [[alternative HTML version deleted]]
>> >
>> > ______________________________________________
>> > [hidden email] 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-contained, reproducible code.
>>
>> ______________________________________________
>> [hidden email] 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-contained, reproducible code.
>
> ______________________________________________
> [hidden email] 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-contained, reproducible code.

______________________________________________
[hidden email] 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-contained, reproducible code.