R_Analytics

 

mydata2 <- read.csv(url("http://127.0.0.1:8000/workbook/id/18/csv/namedrange/getcellvalues/banana_data?username=admin@acme.com&password=T1TAN1UM&delim=none"))

The Revolution R Analytics platform is a powerful data analysis and information graphics tool.

Revolution R is commercial open source available for free download from
http://www.revolutionanalytics.com/

After installing the R product from Revolution Analytics, the R console application
will launch giving you the ability to run R commands.

This example will demonstrate how you can use R to access and analyze data residing in
Sheetster using the REST apis.

NOTE: the following URL examples contain variable values in "<>"
these values MUST be customized for your situation or nothing will work.

To analyze data from a Named Range:

Launch the R Console, type:

> options(warn=-1)
> read.table('http://127.0.0.1:8000/workbook/id/<document meme id>/csv/namedrange/getcellvalues/test_name?delim=&username=<username>&password=<password>')

V1
1 this,little,piggie,
2 one,two,three,
3 seven,eight,nine,
4 twelve,ten,nine


> read.table('http://127.0.0.1:8000/workbook/id/<document meme id>/csv/namedrange/getcellvalues/test_name?username=<username>&password=<password>')
V1 V2
1 this ,'little','piggie',
2 one ,'two','three',
3 seven ,'eight','nine',
4 twelve ,'ten','nine'


Advanced Revolution R Data Example:

NOTE: based upon the Revolution R tutorial at:
http://www.ats.ucla.edu/stat/r/dae/logit.htm

Launch sheetster and upload the csv file located in this folder.

The CSV takes the form of 4 data fields:
admit gre gpa rank

Launch the Revolution R Console and enter the following commands:

> mydata2 <- read.csv(url("http://127.0.0.1:8000/workbook/id/<document meme id>/csv/sheet/get/0?username=<username>&password=<password>&delim=none"))
> attach(mydata2)
> names(mydata2)
[1] "admit" "gre" "gpa" "rank"
> summary(gre)
Min. 1st Qu. Median Mean 3rd Qu. Max.
220.0 520.0 580.0 587.7 660.0 800.0

Ok, now make a change to the maximum GRE value... reattaching the R data shows the updated value.

> detach(mydata2)
> mydata2 <- read.csv(url("http://127.0.0.1:8000/workbook/id/<document meme id>/csv/sheet/get/0?username=<username>&password=<password>&delim=none"))
> attach(mydata2)

> summary(gre)
Min. 1st Qu. Median Mean 3rd Qu. Max.
220 520 580 589 665 901
>

And for a final example, we can create a Sheetster Doc App which gathers this admissions data through an online survey form:

Step 1. Create a sheetster form containing the four fields: admit gre gpa rank


a) create a 4x4 named range called "admissions" matching:

Admissions Data Form
admit admit na na
gre gre na na
gpa gpa na na
rank rank na na
onsubmit alert('Thank you!')

b) click on the named range link in the drop down and then from Named Range ribbon menu, click the "Data Form" button

NOTE: Sheetster conveniently appends 3 additional data fields, the username, ip address, and timestamp of the data entry.

Step 2. Test the form and enter some data
Step 3. Acquire the REST URL for the Data Named Range.
Look for the named range with the same name as the form named range but with "_data" appended.
Step 4. Launch the Revolution R Console and enter the following commands:

> mydata2 <- read.csv(url("http://127.0.0.1:8000/workbook/id/<document meme id>/csv/namedrange/getcellvalues/admissions_data?username=<username>&password=<password>&delim=none"))
> attach(mydata2)
> names(mydata2)
[1] "Enter.Admission" "GRE" "GPA" "Rank" "onsubit" "Username" "Timestamp" "IP.Address"

> summary(GPA)
Min. 1st Qu. Median Mean 3rd Qu. Max.
2.000 2.500 3.000 2.667 3.000 3.000
>

NOTE: your results will vary depending upon the values entered.

Sheetster is now being used as a front-end to R Data!

NOTE: If your data needs are unique, or the Sheetster output does not suit your needs, it is a simple matter to create RESTFul inline Sheetster Plugins per the pluggable REST api mechanism to create a custom REST URL returning the output of any custom Java code.