tchakravarty
tchakravarty

Reputation: 10974

Rcpp: "Cannot change working directory" when called with embedded R code

I have been successfully using Rcpp for a while, and have been able to experiment with most of its features. However, on a Windows 7 machine, with RStudio 0.98.1049 I am not able to sourceCpp a file that has embedded R code chunks in it.

Here is M(N)WE:

#include <Rcpp.h>
using namespace Rcpp;

// [[Rcpp::export]]
double plusOne(double x) {
  return x + 1.0;
}


/*** R
plusOne(3)
*/

When I sourceCpp(..., embeddedR = TRUE), I get this error message:

Error in setwd(rWorkingDir) : cannot change working directory

which I am guessing arises from line 181 here. Not sure how to fix this. I am able to change directories from RStudio in general.

Upvotes: 1

Views: 543

Answers (1)

Kevin Ushey
Kevin Ushey

Reputation: 21285

This issue was resolved with Rcpp 0.11.3 -- it should go away if you update.

Upvotes: 2

Related Questions