RSS
Web Interfaces to GNU (S) - R
The
following Web
interface allows a user to submit R scripts interactively;
edit the scripts; and resubmit the changed script by selecting the
hypertext link button: "Run Program". This interface is used only
for existing datasets that are part of the R system and for
demonstrations and simulations done in R. A different mechanism
for uploading your own datasets
is outlined below. Example R
Scripts for use and modification are provided at the bottom of this
web page - some of which run
and return output, others are just script examples that do not
run. These R scripts can be run locally on your desktop PC by
installing the appropriate binary version of R on your PC. A
Windows version can be downloaded
here. You will also need to install
some additional packages. Other binary versions can be found here. As an
example of using the Rweb web interface, click the
"Run Program" button. This R script creates a vector of 10
random normal deviates; displays the results; calculates the mean of
the vector; and creates a histogram of the random numbers. To
view any text output, scroll to the bottom of the browser window.
To view any graphical output, select the "Display Graphic" link.
Selecting the browser "back page" button will return the reader to this
document.
An example R Script (click the "Run Program" icon to submit; click your
back-page in your web browser to return to this web page):
|
Depending
on the user load, response times can vary. If you are
experiencing slow response times, choose an alternate server that is
hosting the R web interface
Alternate servers: |
Upload
to Rweb Server Unlike
the
above URL's, the following URL will allow you to upload a
tab-delimited text file to the RSS
server for R analysis. The first line needs to consist of
tab-delimited variable names. The Rweb javascript
automatically saves the data set in a dataset called X (that is an 'upper-case X').
To
reference variables in your data set you can use the following
collection of R functions:
# Note: The "pound-signs" are comments;
"var1" is a hypothetical variable name in
# the dataset named "X". Make sure that you replace "var1" with
your own variable
# name. The dataset is automatically named "X" when it is
uploaded to Rweb server
names(X)
# the "names" function shows what the variable names are in "X"
attach(X)
# the "attach" function allows one to reference the variables
without
# using the name of the dataset every time a variable is referred
to. # After the attach function of "X",
if "var1" is a
variable in your data set, use the
# following to reference "var1" for analysis:
var1
# type the name of the variable to
display the values of "var1"
summary(var1) # calculates summary
statistics of the values of variable "var1"
# Note: if you don't use the attach function you can use the
"pound-sign" to reference
# a variable that exists in a dataset as follows:
X$var1
# display values of var1
summary(X$var1) # summarize values of var1 |
R Script Examples (note that some of these scripts are
"live" scripts - these scripts run in place and return output to your
web browser) |