Added test function for embedded R