Skip to content

Commit 615712b

Browse files
author
ripley
committed
add asRboolean
git-svn-id: https://svn.r-project.org/R/trunk@87818 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 7da17dc commit 615712b

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

doc/NEWS.Rd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,10 @@
346346
If there were a platform which used an underlying type of a
347347
different size this would be an ABI-breaking change (but we are
348348
unaware of any such platform).
349+
350+
\item There is a new function \code{asRboolean}, a variannt of
351+
\code{asLogical} more suitable to converting logical arguments to
352+
\code{Rboolean}.
349353
}
350354
}
351355

doc/manual/R-exts.texi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13176,11 +13176,19 @@ failed. There are also @code{Rf_asInteger}, @code{Rf_asReal} and
1317613176
@code{Rf_asComplex}. The function @code{Rf_asChar} returns a @code{CHARSXP}.
1317713177
All of these functions ignore any elements of an input vector after the
1317813178
first.
13179+
13180+
@code{Rf_aaRboolean} is a stricter version of @code{Rf_asLogical}
13181+
introduced in @R{}@tie{}4.5.0. It returns type @code{Rboolean} and
13182+
gives an error for an input of length other than one, and for
13183+
coercion failure.
13184+
13185+
but gives an weeo
1317913186
@apifun Rf_asInteger
1318013187
@apifun Rf_asLogical
1318113188
@apifun Rf_asReal
1318213189
@apifun Rf_asComplex
1318313190
@apifun Rf_asChar
13191+
@apifun Rf_asRboolean
1318413192
The function @code{Rf_asCharacterFactor} converts a factor to a character
1318513193
vector.
1318613194
@apifun Rf_asCharacterFactor

src/include/Rinternals.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ int Rf_asLogical(SEXP x);
487487
int Rf_asInteger(SEXP x);
488488
double Rf_asReal(SEXP x);
489489
Rcomplex Rf_asComplex(SEXP x);
490+
Rboolean Rf_asRboolean(SEXP x);
490491

491492

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

0 commit comments

Comments
 (0)