2

I'm writing a function using the Rcpp package that takes an Rcpp character vector as an input. This character vector contains numbers in a character format ("1", "2", "3", etc.) and I was wondering how to convert this vector of character to integer type within the function body?

If I were writing this function using R I could simply pass the character vector to the as.numeric() function in base R.

ali477
  • 21
  • 1
  • 4
    Welcome to StackOverflow. You can use this site to search by topic and tag. For example, [this link](https://stackoverflow.com/search?q=%5Bc%2B%2B%5D+convert+char+to+int) points to answers to `[c++] convert char to int` -- which restricts it to the C++ language. A couple of programming books may also help as you try to expand your R use with C++. – Dirk Eddelbuettel Oct 01 '19 at 02:48
  • 2
    Take a look over at [this](https://stackoverflow.com/questions/49015611/convert-individual-rcppintegervector-element-to-a-character) Where a very similar question was asked. – Foxhound Oct 01 '19 at 03:32

0 Answers0