| check_rcpp | R Documentation |
Extracts the embedded R and Cpp portions from a cpp file.
check_embedded_r(state) check_cpp(state)
state |
An exercise state, as returned by |
A child state.
## Not run:
# Example solution cpp
#include <Rcpp.h>
using namespace Rcpp ;
// [[Rcpp::export]]
int answer(){
return 42 ;
}
/*** R
x <- answer()
x
*/
# SCT
ex() %>% check_cpp(.) %>% check_code(., "return//s+42//s+;")
ex() %>% check_embedded_r(.) %>% check_function("answer") %>% check_result()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.