[Rcpp-devel] Bug with table sugar and NumericVector in Rcpp 0.10.3

Romain Francois romain at r-enthusiasts.com
Tue Apr 2 20:23:35 CEST 2013


Le 02/04/13 20:04, Chenliang Xu a écrit :
> Maybe not. I think a function in library should do only one thing, and
> for DataFrame::create it is building a data.frame. If the users wish to
> convert string to factor, one should do it explicitly, may with a help
> function such as `stringsToFactor` or `as.factor`. stringsAsFactor is an
> important feature at R side, but does RCpp have to match the exact
> interface of R?
>
> For now, RCpp doesn't really support factor. Returning a data.frame with
> factor element would make it useless for RCpp.
>
> Hi Romain,
>
> I'm curious about the difference between the code on SVN and the old
> one. I read the code, and understand the new one is using List, while
> the old one actually call something like as.data.frame(data.frame(t1,
> t2, ...)) on R side. I just don't know why one would work while the
> other doesn't.

We were calling

data.frame(t1, t2, ... )

Now we do:

as.data.frame( list(t1, t2, ...) )

(what actually happens is more complex as it deals with names)

> On Tue, Apr 2, 2013 at 10:16 AM, Romain Francois
> <romain at r-enthusiasts.com <mailto:romain at r-enthusiasts.com>> wrote:
>
>     Le 02/04/13 17:01, Dirk Eddelbuettel a écrit :
>
>
>         On 2 April 2013 at 16:36, Romain Francois wrote:
>         | Le 29/03/13 16:37, Dirk Eddelbuettel a écrit :
>         | >
>         | > On 29 March 2013 at 16:20, romain at r-enthusiasts.com
>         <mailto:romain at r-enthusiasts.com> wrote:
>         | > | Cool. I'll have a look when I'm back from easter weekend.
>         | >
>         | > Sounds good.
>         | >
>         | > And that point, it would be really nice if you could also
>         restore the ability
>         | > to build Rcpp, which appears to have broken with your
>         Data.Frame patch.
>         | >
>         | > Details are below.
>         |
>         | Should be back up now. With new versions of DataFrame::create
>         that work
>         | better.
>
>         Nice.
>
>         And it builds, but doesn't pass (all) tests yet:
>
>         checking tests ...
>             Running ‘doRUnit.R’ [185s/193s]
>            ERROR
>         Running the tests in ‘tests/doRUnit.R’ failed.
>         Last 13 lines of output:
>             Executing test function test.wstring_param  ...  done
>         successfully.
>
>
>
>             Executing test function test.wstring_return  ...  done
>         successfully.
>
>             saving txt unit test report to
>         '/home/edd/svn/rcpp/pkg/Rcpp.__Rcheck/tests/Rcpp-unitTests.__txt'
>             saving html unit test report to
>         '/home/edd/svn/rcpp/pkg/Rcpp.__Rcheck/tests/Rcpp-unitTests.__html'
>             Error in eval(expr, envir, enclos) :
>               unit test problems: 1 failures, 0 errors
>             Error in checkEquals(__createTwoStringsAsFactors(), DF, msg
>         = "DataFrame create2 stringsAsFactors = false") :   Length
>         mismatch: comparison on first 2 componentsComponent 2: 'current'
>         is not a factorDataFrame create2 stringsAsFactors = false
>             Calls: source -> withVisible -> eval -> eval
>             Execution halted
>
>
>         Does it for you?
>
>
>     Aah. No it does not.
>
>     This is not supported by the new code:
>
>     DataFrame::create(
>                      _["a"] = v,
>                      _["b"] = s,
>                      _["stringsAsFactors"] = false );
>
>     I forgot that we support this and ran the tests just before making
>     that change.
>
>     Do we really need this feature ?
>
>
>     --
>     Romain Francois
>     Professional R Enthusiast
>     +33(0) 6 28 91 30 30 <tel:%2B33%280%29%206%2028%2091%2030%2030>
>
>     R Graph Gallery: http://gallery.r-enthusiasts.__com
>     <http://gallery.r-enthusiasts.com>
>
>     blog: http://blog.r-enthusiasts.com
>     |- http://bit.ly/ZTFLDo : Simpler R help tooltips
>     `- http://bit.ly/YFsziW : R Help tooltips
>
>     _________________________________________________
>     Rcpp-devel mailing list
>     Rcpp-devel at lists.r-forge.r-__project.org
>     <mailto:Rcpp-devel at lists.r-forge.r-project.org>
>     https://lists.r-forge.r-__project.org/cgi-bin/mailman/__listinfo/rcpp-devel
>     <https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel>
>
>


-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30

R Graph Gallery: http://gallery.r-enthusiasts.com

blog:            http://blog.r-enthusiasts.com
|- http://bit.ly/ZTFLDo : Simpler R help tooltips
`- http://bit.ly/YFsziW : R Help tooltips



More information about the Rcpp-devel mailing list