Skip to content

Commit

Permalink
Deploying to gh-pages from @ 1ae810d 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
andrie committed Oct 20, 2024
1 parent e0cc5b3 commit a16bd7a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion r-exts/The-R-API.html
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,7 @@ <h2 class="section anchored" data-number="6.10" data-anchor-id="utility-function
<!-- -->
<p><span class="category">Function:</span><em>double</em> <strong>R_atof</strong> <em>(const char* <code>str</code>)</em> <a href="#index-r_atof-2" class="copiable-anchor"></a><br>
<span class="category">Function:</span><em>double</em> <strong>R_strtod</strong> <em>(const char* <code>str</code>, char ** <code>end</code>)</em> <a href="#index-r_strtod-2" class="copiable-anchor"></a></p>
<p>: Implementations of the C99/POSIX functions <code>atof</code> and <code>strtod</code> which guarantee platform-dependent behaviour, including always using the period as the decimal point <em>aka</em> ‘radix character’ and returning R’s <code>NA_REAL_</code> for all unconverted strings, including <code>"NA"</code>.</p>
<p>: Implementations of the C99/POSIX functions <code>atof</code> and <code>strtod</code> which guarantee platform- and locale-independent behaviour, including always using the period as the decimal point <em>aka</em> ‘radix character’ and returning R’s <code>NA_REAL_</code> for all unconverted strings, including <code>"NA"</code>.</p>
<p>There is also the internal function used to expand file names in several R functions, and called directly by <code>path.expand</code>.</p>
<dl>
<dt><span class="category">Function:</span><em>const char *</em> <strong>R_ExpandFileName</strong> <em>(const char *<code>fn</code>)</em> <a href="#index-r_expandfilename-2" class="copiable-anchor"></a></dt>
Expand Down
2 changes: 1 addition & 1 deletion r-exts/search.json
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@
"href": "The-R-API.html#utility-functions",
"title": "6  The R API: entry points for C code",
"section": "6.10 Utility functions",
"text": "6.10 Utility functions\nR has a fairly comprehensive set of sort routines which are made available to users’ C code. The following is declared in header file Rinternals.h.\nFunction:void R_orderVector (int* indx, int n, SEXP arglist, Rboolean nalast, Rboolean decreasing) ¶\nFunction:void R_orderVector1 (int* indx, int n, SEXP x, Rboolean nalast, Rboolean decreasing) ¶\n: R_orderVector() corresponds to R’s order(..., na.last, decreasing). More specifically, indx &lt;- order(x, y, na.last, decreasing) corresponds to R_orderVector(indx, n, Rf_lang2(x, y), nalast, decreasing) and for three vectors, Rf_lang3(x,y,z) is used as arglist.\nBoth `R_orderVector` and `R_orderVector1` assume the vector `indx`\nto be allocated to length \\&gt;= n. On return, `indx[]` contains a\npermutation of `0:(n-1)`, i.e., 0-based C indices (and not 1-based R\nindices, as R's `order()`).\n\nWhen ordering only one vector, `R_orderVector1` is faster and\ncorresponds (but is 0-based) to R's\n`indx &lt;- order(x, na.last, decreasing)`. It was added in R 3.3.0.\nAll other sort routines are declared in header file R_ext/Utils.h (included by R.h) and include the following.\nFunction:void R_isort (int* x, int n) ¶\nFunction:void R_rsort (double* x, int n) ¶\nFunction:void R_csort (Rcomplex* x, int n) ¶\nFunction:void rsort_with_index (double* x, int* index, int n) ¶\n: The first three sort integer, real (double) and complex data respectively. (Complex numbers are sorted by the real part first then the imaginary part.) NAs are sorted last.\n`rsort_with_index` sorts on `x`, and applies the same\npermutation to `index`. `NA`s are sorted last.\n\n\nFunction:void revsort (double* x, int* index, int n) ¶\n\nIs similar to rsort_with_index but sorts into decreasing order, and NAs are not handled.\n\n\n\nFunction:void iPsort (int* x, int n, int k) ¶\nFunction:void rPsort (double* x, int n, int k) ¶\nFunction:void cPsort (Rcomplex* x, int n, int k) ¶\n: These all provide (very) partial sorting: they permute x so that x[k] is in the correct place with smaller values to the left, larger ones to the right.\n\nFunction:void R_qsort (double *v, size_t i, size_t j) ¶\nFunction:void R_qsort_I (double *v, int *I, int i, int j) ¶\nFunction:void R_qsort_int (int *iv, size_t i, size_t j) ¶\nFunction:void R_qsort_int_I (int *iv, int *I, int i, int j) ¶\n: These routines sort v[i:j] or iv[i:j] (using 1-indexing, i.e., v[1] is the first element) calling the quicksort algorithm as used by R’s sort(v, method = \"quick\") and documented on the help page for the R function sort. The ..._I() versions also return the sort.index() vector in I. Note that the ordering is not stable, so tied values may be permuted.\nNote that `NA`s are not handled (explicitly) and you should use\ndifferent sorting functions if `NA`s can be present.\n\nFunction:subroutine qsort4 (double precision v, integer indx, integer ii, integer jj) ¶\nFunction:subroutine qsort3 (double precision v, integer ii, integer jj) ¶\n: The Fortran interface routines for sorting double precision vectors are qsort3 and qsort4, equivalent to R_qsort and R_qsort_I, respectively.\n\n\nFunction:void R_max_col (double* matrix, int* nr, int* nc, int* maxes, int* ties_meth) ¶\n\nGiven the nr by nc matrix matrix in column-major (“Fortran”) order, R_max_col() returns in maxes[i-1] the column number of the maximal element in the i-th row (the same as R’s max.col() function). In the case of ties (multiple maxima), *ties_meth is an integer code in 1:3 determining the method: 1 = “random”, 2 = “first” and 3 = “last”. See R’s help page ?max.col.\n\n\n\nFunction:int findInterval (double* xt, int n, double x, Rboolean rightmost_closed, Rboolean all_inside, int ilo, int* mflag) ¶\nFunction:int findInterval2 (double* xt, int n, double x, Rboolean rightmost_closed, Rboolean all_inside, Rboolean left_open, int ilo, int* mflag) ¶\n: Given the ordered vector xt of length n, return the interval or index of x in xt[], typically max(i; 1 &lt;= i &lt;= n & xt[i] &lt;= x) where we use 1-indexing as in R and Fortran (but not C). If rightmost_closed is true, also returns n-1 if x equals xt[n]. If all_inside is not 0, the result is coerced to lie in 1:(n-1) even when x is outside the xt[] range. On return, *mflag equals -1 if x &lt; xt[1], +1 if x &gt;= xt[n], and 0 otherwise.\nThe algorithm is particularly fast when `ilo` is set to\nthe last result of `findInterval()` and `x` is a value of\na sequence which is increasing or decreasing for subsequent calls.\n\n`findInterval2()` is a generalization of `findInterval()`, with an\nextra `Rboolean` argument `left_open`. Setting\n`left_open = TRUE` basically replaces all left-closed right-open\nintervals t) by left-open ones t\\], see the help page of R function\n`findInterval` for details.\n\nThere is also an `F77_CALL(interv)()` version of `findInterval()`\nwith the same arguments, but all pointers.\nA system-independent interface to produce the name of a temporary file is provided as\nFunction:char * R_tmpnam (const char *prefix, const char *tmpdir) ¶\nFunction:char * R_tmpnam2 (const char *prefix, const char *tmpdir, const char *fileext) ¶\nFunction:void R_free_tmpnam (char *name) ¶\n: Return a pathname for a temporary file with name beginning with prefix and ending with fileext in directory tmpdir. A NULL prefix or extension is replaced by \"\". Note that the return value is dynamically allocated and should be freed using R_free_tmpnam when no longer needed (unlike the system call tmpnam). Freeing the result using free is no longer recommended.\n\nFunction:double R_atof (const char* str) ¶\nFunction:double R_strtod (const char* str, char ** end) ¶\n: Implementations of the C99/POSIX functions atof and strtod which guarantee platform-dependent behaviour, including always using the period as the decimal point aka ‘radix character’ and returning R’s NA_REAL_ for all unconverted strings, including \"NA\".\nThere is also the internal function used to expand file names in several R functions, and called directly by path.expand.\n\nFunction:const char * R_ExpandFileName (const char *fn) ¶\n\nExpand a path name fn by replacing a leading tilde by the user’s home directory (if defined). The precise meaning is platform-specific; it will usually be taken from the environment variable HOME if this is defined.\n\n\nFor historical reasons there are Fortran interfaces to functions D1MACH and I1MACH. These can be called from C code as e.g. F77_CALL(d1mach)(4). Note that these are emulations of the original functions by Fox, Hall and Schryer on Netlib at https://netlib.org/slatec/src/ for IEC 60559 arithmetic (required by R).",
"text": "6.10 Utility functions\nR has a fairly comprehensive set of sort routines which are made available to users’ C code. The following is declared in header file Rinternals.h.\nFunction:void R_orderVector (int* indx, int n, SEXP arglist, Rboolean nalast, Rboolean decreasing) ¶\nFunction:void R_orderVector1 (int* indx, int n, SEXP x, Rboolean nalast, Rboolean decreasing) ¶\n: R_orderVector() corresponds to R’s order(..., na.last, decreasing). More specifically, indx &lt;- order(x, y, na.last, decreasing) corresponds to R_orderVector(indx, n, Rf_lang2(x, y), nalast, decreasing) and for three vectors, Rf_lang3(x,y,z) is used as arglist.\nBoth `R_orderVector` and `R_orderVector1` assume the vector `indx`\nto be allocated to length \\&gt;= n. On return, `indx[]` contains a\npermutation of `0:(n-1)`, i.e., 0-based C indices (and not 1-based R\nindices, as R's `order()`).\n\nWhen ordering only one vector, `R_orderVector1` is faster and\ncorresponds (but is 0-based) to R's\n`indx &lt;- order(x, na.last, decreasing)`. It was added in R 3.3.0.\nAll other sort routines are declared in header file R_ext/Utils.h (included by R.h) and include the following.\nFunction:void R_isort (int* x, int n) ¶\nFunction:void R_rsort (double* x, int n) ¶\nFunction:void R_csort (Rcomplex* x, int n) ¶\nFunction:void rsort_with_index (double* x, int* index, int n) ¶\n: The first three sort integer, real (double) and complex data respectively. (Complex numbers are sorted by the real part first then the imaginary part.) NAs are sorted last.\n`rsort_with_index` sorts on `x`, and applies the same\npermutation to `index`. `NA`s are sorted last.\n\n\nFunction:void revsort (double* x, int* index, int n) ¶\n\nIs similar to rsort_with_index but sorts into decreasing order, and NAs are not handled.\n\n\n\nFunction:void iPsort (int* x, int n, int k) ¶\nFunction:void rPsort (double* x, int n, int k) ¶\nFunction:void cPsort (Rcomplex* x, int n, int k) ¶\n: These all provide (very) partial sorting: they permute x so that x[k] is in the correct place with smaller values to the left, larger ones to the right.\n\nFunction:void R_qsort (double *v, size_t i, size_t j) ¶\nFunction:void R_qsort_I (double *v, int *I, int i, int j) ¶\nFunction:void R_qsort_int (int *iv, size_t i, size_t j) ¶\nFunction:void R_qsort_int_I (int *iv, int *I, int i, int j) ¶\n: These routines sort v[i:j] or iv[i:j] (using 1-indexing, i.e., v[1] is the first element) calling the quicksort algorithm as used by R’s sort(v, method = \"quick\") and documented on the help page for the R function sort. The ..._I() versions also return the sort.index() vector in I. Note that the ordering is not stable, so tied values may be permuted.\nNote that `NA`s are not handled (explicitly) and you should use\ndifferent sorting functions if `NA`s can be present.\n\nFunction:subroutine qsort4 (double precision v, integer indx, integer ii, integer jj) ¶\nFunction:subroutine qsort3 (double precision v, integer ii, integer jj) ¶\n: The Fortran interface routines for sorting double precision vectors are qsort3 and qsort4, equivalent to R_qsort and R_qsort_I, respectively.\n\n\nFunction:void R_max_col (double* matrix, int* nr, int* nc, int* maxes, int* ties_meth) ¶\n\nGiven the nr by nc matrix matrix in column-major (“Fortran”) order, R_max_col() returns in maxes[i-1] the column number of the maximal element in the i-th row (the same as R’s max.col() function). In the case of ties (multiple maxima), *ties_meth is an integer code in 1:3 determining the method: 1 = “random”, 2 = “first” and 3 = “last”. See R’s help page ?max.col.\n\n\n\nFunction:int findInterval (double* xt, int n, double x, Rboolean rightmost_closed, Rboolean all_inside, int ilo, int* mflag) ¶\nFunction:int findInterval2 (double* xt, int n, double x, Rboolean rightmost_closed, Rboolean all_inside, Rboolean left_open, int ilo, int* mflag) ¶\n: Given the ordered vector xt of length n, return the interval or index of x in xt[], typically max(i; 1 &lt;= i &lt;= n & xt[i] &lt;= x) where we use 1-indexing as in R and Fortran (but not C). If rightmost_closed is true, also returns n-1 if x equals xt[n]. If all_inside is not 0, the result is coerced to lie in 1:(n-1) even when x is outside the xt[] range. On return, *mflag equals -1 if x &lt; xt[1], +1 if x &gt;= xt[n], and 0 otherwise.\nThe algorithm is particularly fast when `ilo` is set to\nthe last result of `findInterval()` and `x` is a value of\na sequence which is increasing or decreasing for subsequent calls.\n\n`findInterval2()` is a generalization of `findInterval()`, with an\nextra `Rboolean` argument `left_open`. Setting\n`left_open = TRUE` basically replaces all left-closed right-open\nintervals t) by left-open ones t\\], see the help page of R function\n`findInterval` for details.\n\nThere is also an `F77_CALL(interv)()` version of `findInterval()`\nwith the same arguments, but all pointers.\nA system-independent interface to produce the name of a temporary file is provided as\nFunction:char * R_tmpnam (const char *prefix, const char *tmpdir) ¶\nFunction:char * R_tmpnam2 (const char *prefix, const char *tmpdir, const char *fileext) ¶\nFunction:void R_free_tmpnam (char *name) ¶\n: Return a pathname for a temporary file with name beginning with prefix and ending with fileext in directory tmpdir. A NULL prefix or extension is replaced by \"\". Note that the return value is dynamically allocated and should be freed using R_free_tmpnam when no longer needed (unlike the system call tmpnam). Freeing the result using free is no longer recommended.\n\nFunction:double R_atof (const char* str) ¶\nFunction:double R_strtod (const char* str, char ** end) ¶\n: Implementations of the C99/POSIX functions atof and strtod which guarantee platform- and locale-independent behaviour, including always using the period as the decimal point aka ‘radix character’ and returning R’s NA_REAL_ for all unconverted strings, including \"NA\".\nThere is also the internal function used to expand file names in several R functions, and called directly by path.expand.\n\nFunction:const char * R_ExpandFileName (const char *fn) ¶\n\nExpand a path name fn by replacing a leading tilde by the user’s home directory (if defined). The precise meaning is platform-specific; it will usually be taken from the environment variable HOME if this is defined.\n\n\nFor historical reasons there are Fortran interfaces to functions D1MACH and I1MACH. These can be called from C code as e.g. F77_CALL(d1mach)(4). Note that these are emulations of the original functions by Fox, Hall and Schryer on Netlib at https://netlib.org/slatec/src/ for IEC 60559 arithmetic (required by R).",
"crumbs": [
"<span class='chapter-number'>6</span>  <span class='chapter-title'>The R API: entry points for C code</span>"
]
Expand Down

0 comments on commit a16bd7a

Please sign in to comment.