Importing Data into Birst
from R
To import an R data set into Birst
for the first time, you can provide the path of the file on the R server.
Birst will read that
file and attempt to process it as if it were uploaded like any other file.
To import R data into Birst
|
1.
|
Create a file
on your R Server by writing out a data frame using standard delimiters.
For example, to write out the standard iris data frame to a file, you
could use the following:
write.table(iris,”/home/rstudio/iris.txt",col.names=TRUE,
sep="|", qmethod="escape")
This writes the data out appropriately delimited with column headers, such
that Birst can import
it using the path specified “/home/rstudio/iris.txt”. |
|
2.
|
Use the Upload
Files page to upload the file from the R Server. In the Admin module,
click the Define Sources tab, then Upload Files. |
|
3.
|
In the Upload
from R Server section, specify the R server file path of the file to upload
and click Get Data.
|
|
4.
|
Once a file
is uploaded, Birst
automatically saves the link information in the data source so that upon
subsequent processing, this file will be re-uploaded. This way, new data
sets can be pulled from R as part of a regularly scheduled load process.
The screen shot below shows the Properties tab for the newly uploaded
source on the Manage Sources page with the Manage Linkage to R Server
button.
|
|
5.
|
Click Manage
Linkage to R Server to open the Properties.
|
|
6.
|
Birst maintains the path to the
original source in R. If the Re-extract file from R during processing
box is checked in this dialog box, Birst
will attempt to re-retrieve this data source each time this space is processed.
|
|
7.
|
Optionally,
you can use the text box to provide an R expression that can be executed
during the re-extraction process. This allows you to add R code that executes
before the extraction to generate a new data set. For example, you could
use the first part of an ETL process to move some new data into R, then
use this text box to train a model on that data, then score a new result
set that is loaded back into Birst. |
Next Steps
Moving
Data from Birst to
R
Setting
Up Sessions with R Initializers
Calling
R Inline in a Report or ETL Script