Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork219
Closed
Description
It seems to me that CharacterVector and StringVector have the same behaviour. (correct me if I am wrong)
It is OK because as far as I know R treats single chars as strings.
However, creating a CharacterVector from char produce wrong results in Rcpp
Here is an example:
#include<Rcpp.h>usingnamespaceRcpp;// [[Rcpp::export]]NumericMatrixtest_character_vector(){ NumericMatrixm(3,3);rownames(m) =CharacterVector::create('a','b','c');return m;}/*** Rm1=matrix(nrow = 3,ncol=3)rownames(m1)=c('a','b','c')rownames(m1) #OKm2=test_character_vector()rownames(m2) # WRONG*/
Result
> m1=matrix(nrow = 3,ncol=3)> rownames(m1)=c('a','b','c')> rownames(m1) #OK[1] "a" "b" "c"> m2=test_character_vector()> rownames(m2) # WRONG[1] "abc" "bc" "c"Metadata
Metadata
Assignees
Labels
No labels