[R] class of 'try' if error is raised

2019-12-15 Thread Hans W Borchers
I have been informed by CRAN administrators that the development version of R issues warnings for my package(s). Some are easy to mend (such as Internet links not working anymore), but this one I don't know how to avoid: Error in if (class(e) == "try-error") { : the condition has length > 1

Re: [R] class of 'try' if error is raised

2019-12-15 Thread Enrico Schumann
> "HW" == Hans W Borchers writes: HW> I have been informed by CRAN administrators that the development HW> version of R issues warnings for my package(s). Some are easy to mend HW> (such as Internet links not working anymore), but this one I don't HW> know how to avoid: HW>

Re: [R] class of 'try' if error is raised

2019-12-15 Thread Bert Gunter
See ?try which links you to ?tryCatch for the preferred approach. Alternatively: if(inherits(e, "try-error")) ## should work and satisfy CRAN -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley

Re: [R] Please help translate this program in C++ to R

2019-12-15 Thread Richard O'Keefe
As a C implementation of merge sort, that is the very reverse of impressive. I would not translate *that* code into anything. There is a fundamental difference between between arrays in C and arrays in R, and it is the same as the difference between Python and R. You are MUCH better to start from

Re: [R] class of 'try' if error is raised

2019-12-15 Thread Hans W Borchers
Yes, CRAN did accept 'if(inherits(e, "try-error"))'. I remember now, when I used the try-construct the first time, I also saw tryCatch and found it a bit too extensive for my purposes. Will look at it again when needed. Thanks to you and Enrico On Sun, 15 Dec 2019 at 16:03, Bert Gunter wrote:

Re: [R] Please help translate this program in python to R.

2019-12-15 Thread Richard O'Keefe
The obvious question is "why?" If you just want to sort stuff, ?sort and ?order tell you about the sorting methods available in R. If you want to translate this specific algorithm into R for some reason, (a) if you don't know enough about array processing in R to do this yourself, how are you