Skip to content

Commit

Permalink
add asRboolean
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R/trunk@87818 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
ripley committed Feb 25, 2025
1 parent 7da17dc commit 615712b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions doc/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,10 @@
If there were a platform which used an underlying type of a
different size this would be an ABI-breaking change (but we are
unaware of any such platform).
\item There is a new function \code{asRboolean}, a variannt of
\code{asLogical} more suitable to converting logical arguments to
\code{Rboolean}.
}
}
Expand Down
8 changes: 8 additions & 0 deletions doc/manual/R-exts.texi
Original file line number Diff line number Diff line change
Expand Up @@ -13176,11 +13176,19 @@ failed. There are also @code{Rf_asInteger}, @code{Rf_asReal} and
@code{Rf_asComplex}. The function @code{Rf_asChar} returns a @code{CHARSXP}.
All of these functions ignore any elements of an input vector after the
first.

@code{Rf_aaRboolean} is a stricter version of @code{Rf_asLogical}
introduced in @R{}@tie{}4.5.0. It returns type @code{Rboolean} and
gives an error for an input of length other than one, and for
coercion failure.

but gives an weeo
@apifun Rf_asInteger
@apifun Rf_asLogical
@apifun Rf_asReal
@apifun Rf_asComplex
@apifun Rf_asChar
@apifun Rf_asRboolean
The function @code{Rf_asCharacterFactor} converts a factor to a character
vector.
@apifun Rf_asCharacterFactor
Expand Down
2 changes: 2 additions & 0 deletions src/include/Rinternals.h
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ int Rf_asLogical(SEXP x);
int Rf_asInteger(SEXP x);
double Rf_asReal(SEXP x);
Rcomplex Rf_asComplex(SEXP x);
Rboolean Rf_asRboolean(SEXP x);


// also included in R_ext/Rallocators.h
Expand Down Expand Up @@ -900,6 +901,7 @@ void R_orderVector1(int *indx, int n, SEXP x, Rboolean nalast, Rboolean de
#define asInteger Rf_asInteger
#define asLogical Rf_asLogical
#define asLogical2 Rf_asLogical2
#define asRboolean Rf_asRboolean
#define asReal Rf_asReal
#define asS4 Rf_asS4
#define charIsASCII Rf_charIsASCII
Expand Down

0 comments on commit 615712b

Please sign in to comment.