RDataTypeDefinitionsReload

RDataTypeDefinitionsReload[opts]
searches for files with definitions of extra data types, defined by the user to extend the core data type system of RLink, and loads those definitions.

DetailsDetails

  • The following options can be given:
  • "AddToRDataTypePath"Noneadditional places to search for .m files with type definitions (a list of directories)
  • Using makes sense in situations when some new files with extended data types definitions have been created during an RLink session and need to be dynamically loaded without quitting the RLink session.
  • is called internally by InstallR. While being mostly an internal function, it is very useful for interactive development of extended data types definitions, which justifies its public function status.
  • All definitions for data types registered interactively in a given RLink session will be removed after is called, so purely interactive type registrations will be lost. Only definitions saved in files that are on the search path of will be reloaded.

ExamplesExamplesopen allclose all

Basic Examples (1)Basic Examples (1)

In[1]:=
Click for copyable input

Calling only makes sense to dynamically (re)enable new data types just defined and stored in some external files.

This creates a temporary directory to store the sample definitions for new data types:

In[2]:=
Click for copyable input

Here is the string version of the sample data type code used in the reference page for the RDataTypeRegister function, wrapped in a package (namespace):

In[3]:=
Click for copyable input

Export this to create a file with this definition:

In[4]:=
Click for copyable input
Out[4]=

Now everything is ready to reload the data type definitions, including the new file:

In[5]:=
Click for copyable input

You can test that the definition is now effective by using ToRForm:

In[6]:=
Click for copyable input
Out[6]=

You can now send your data to R, using the custom data container just defined:

In[7]:=
Click for copyable input
Out[7]=

The result is automatically converted according to the inverse conversion rule used above in RDataTypeRegister, when returned back from R:

In[8]:=
Click for copyable input
Out[8]=

You can now unregister the data type:

In[9]:=
Click for copyable input
New to Mathematica? Find your learning path »
Have a question? Ask support »