hi,
seems like api/meat/is.h missed the implementation for CharacterVector and
CharacterMatrix, i.e. we should add:
template <> inline bool is__simple( SEXP x ){
return TYPEOF(x) == STRSXP ;
}
template <> inline bool is__simple( SEXP x ){
return TYPEOF(x) == STRSXP &&
Hi,
is_na() does not handles R's NaN correctly, for the below test.cpp:
#include
using namespace Rcpp;
using namespace std;
// [[Rcpp::export]]
void test (NumericVector x)
{
LogicalVector y1 = is_na(x);
LogicalVector y2 = is_finite(x);
LogicalVector y3 = is_infinite(x);
LogicalVector y4
Hi,
in R, is.finite() and is.infinite() always return FALSE for character():
> is.finite(c('abc', NA_character_, 'efg'))
[1] FALSE FALSE FALSE
> is.infinite(c('abc', NA_character_, 'efg'))
[1] FALSE FALSE FALSE
so, we may need to change the template is_finite from:
template <>
inline bool is_f
FALSE
of coz, there're some subtle differences (priority) in doing calculations on
them:
> NaN + 1
[1] NaN
> NA + 1
[1] NA
> NA * Inf
[1] NA
> NaN * Inf
[1] NaN
> NaN * NA
[1] NA
Thomas,
On 2 October 2013 at 19:31, Thomas Tse wrote:
| is_na() does not handles R's NaN
Thanks. Just to note the it's traits::is_finite, rather than is_na(),
that needs to (always) return false
From: Dirk Eddelbuettel
To: Dirk Eddelbuettel
Cc: Thomas Tse ;
"rcpp-devel@lists.r-forge.r-project.org"
Sent: Thursday, October
Hi,
I'm trying to implement a faster version of apply(x, 1L, FUN) in C++ but found
some strange behaviors.
// [[Rcpp::export]]
NumericVector rowApply(NumericMatrix& x, const Function& FUN)
{
int n = x.nrow();
NumericVector result = no_init(n);
for (int r = 0; r < n; r++) {
result[r] =
The next test compares the
speeds:
// [[Rcpp::export]]
NumericVector rowApply0(NumericMatrix&
x, const Function& FUN)
{
int n = x.nrow();
NumericVector result =
no_init(n);
for (int r = 0; r < n; r++)
{
result[r] = as(FUN(x(r,
_) ) );
}
return result;
}
// [[Rcpp::export]]
Nu
Wow Romain!! Dirk and U are really
"Professional R (and C++) Enthusiast" !!!
The following tests verified your words. I just post them for the
benefits of other readers in this list.
With the following C++ functions
exported:
//
[[Rcpp::export]]
void
testErr0(SEXP x, const Function & FUN)
Hello,
bigmemory is not availabe in Windows, so I have to use ff
(http://cran.r-project.org/web/packages/ff/index.html) for big data ...
is there a way that I could reference ff object within Rcpp?
Thanks,
Thomas Tse
___
Rcpp-devel mailing list
Rcpp