Description Objects from the Class Slots Methods Author(s) See Also Examples
This hierarchy of classes from CodeDefinition to RFunctionDefinition and CRoutineDefinition are used as a simple representation of text that is code for a particular function/routine entity.
Use the constructor functions CRoutineDefinition
and RFunctionDefinition
to
create an instance of the appropriate class. These take care of
fixing the code to indent "appropriately" and put it into a single
string. See the internal function formatCode
for how this is
done if you want to enhance it.
code
:Object of class "character"
giving the
name of the routine, i.e. how one would call it and not the declaration.
name
:Object of class "character"
the entire code for the routine in a single string
prototype
:Object of class "character"
that
provides the prototype or declaration for the routine that would
be put in a header/include file.
No methods defined with class "CRoutineDefinition" in the signature.
Duncan Temple Lang
The internal function formatCode
can be used to format
code.
1 2 3 4 5 | CRoutineDefinition("square", c("double",
"square(double x)",
"{",
"return( x * x);",
"}"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.