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] Please help translate this program in C++ to R

2019-12-14 Thread Eric Berger
It is fairly easy to incorporate C++ code into R programs using the Rcpp package. Definitely worth the effort to learn how to do this. On Sun, Dec 15, 2019 at 5:48 AM Boris Steipe wrote: > > See this thread why that's a bad idea ... > https://stackoverflow.com/questions/26080716/merge-sort-in-r

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

2019-12-14 Thread Boris Steipe
See this thread why that's a bad idea ... https://stackoverflow.com/questions/26080716/merge-sort-in-r ... and use the code given there, or give us some context why a literal translation would be important to you. Cheers, Boris > On 2019-12-15, at 05:37, Александр Дубровский wrote: > > /*

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

2019-12-14 Thread Александр Дубровский
/* Iterative C program for merge sort */ #include #include /* Function to merge the two haves arr[l..m] and arr[m+1..r] of array arr[] */ void merge(int arr[], int l, int m, int r); // Utility function to find minimum of two integers int min(int x, int y) { return (xhttps://stat.ethz.ch/mailman/l