data_custom


See also: data_attach, data_create

If you use the program regularly, sooner or later you will find that you need to work with data that is not directly supported by the Stagraph interface. As an example (for current 2.0 version), we can specify XML or JSON files. Since the Stagraph running on the top of R Terminal, you are not limited by its current options. For these purposes, you can use full options of the R Console. The result of custom import can be used within the Stagraph interface. The question is not whether it is possible to import some type of data into Stagraph, but how. An example of custom data import is in the following video tutorial.

If you want to import custom dataset through R scripts, you can use a built-in R Console for script writing and debugging. In this window, in the top part, you write your scripts. In the following figure is created a data.frame object, named Data2. Custom dataset contains 3 variables and 5 records. For this chapter, we used only a very simple example of “manual" definition. This approach allows you to use the full power or R Environment. In the options of data import you are limited only by your knowledge of the R language and related packages. Selected code is executed and tested. The result of your scripts must always be a data.frame object with unique name (within the current project).

If you have your script tested, press the Custom button on the ribbon toolbar.

A help dialog appears, named Dataset From Custom R Code. In this dialog, you need to take only two steps. In the first step, you copy the script from R Console that creates your dataset. The result of this script must be the data.frame object. For detecting the resulted dataset in your script, write its name to the Dataset Name text-box. Remember that R is Case Sensitive, so the name must be identical.

If you have typed the dataset name and copied the custom script, click on the Apply button. If the script is correct and the dataset was successfully created, it will be displayed in the list of datasets in Project Panel and in the Data Preview Document.

You can import your data into Stagraph practically from any source. For specific data sources, you can use the data_custom function. With this feature, you can import data via R scripts. R language (together with the installable packages) gives you practically unlimited options. The only condition is that the resulted dataset must form a data.frame object with unique name. Using external R packages you can import data also from very special data sources (e.g. XML files, web services, ...). Examples of adjustable scripts you can find on the Internet. Further examples will be posted in the blog section.