MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / cppLiteralArgToRArg

Function cppLiteralArgToRArg

src/attributes.cpp:2688–2705  ·  view source on GitHub ↗

convert a C++ literal to an R argument (returns empty string if no conversion possible)

Source from the content-addressed store, hash-verified

2686 // convert a C++ literal to an R argument (returns empty string
2687 // if no conversion possible)
2688 std::string cppLiteralArgToRArg(const std::string& cppArg) {
2689 if (cppArg == "true")
2690 return "TRUE";
2691 else if (cppArg == "false")
2692 return "FALSE";
2693 else if (cppArg == "R_NilValue")
2694 return "NULL";
2695 else if (cppArg == "NA_STRING") // #nocov start
2696 return "NA_character_";
2697 else if (cppArg == "NA_INTEGER")
2698 return "NA_integer_";
2699 else if (cppArg == "NA_LOGICAL")
2700 return "NA_integer_";
2701 else if (cppArg == "NA_REAL")
2702 return "NA_real_";
2703 else
2704 return std::string();
2705 }
2706
2707 // convert an Rcpp container constructor to an R argument
2708 // (returns empty string if no conversion possible)

Callers 1

cppArgToRArgFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected