Examples of the S Language Plugin for Netscape

This is a collection of examples illustrating how one can use the S Language (i.e. R and potentially S-Plus) Plugin for Netscape. There are several examples and they are here to provide ideas about how to use JavaScript, HTML and S together. They are not intended to be serious efforts to design interfaces, etc.

Currently, not all of these will necessarily run correctly when loaded from different starting locations. This is because some depend on other files (specifically files that are read into R) that need to be found relative to the document. This will be fixed in the near future, but are presently used mainly for testing the Plugin.

  • barFrames.html
    Presents 3 frames, one containing an input form and the other two presenting dynamically generated output. The input form contains a button that one clicks to generate a new sample of size 10. The individual values are presented in the top right frame and the mean is displayed in the lower right frame. R generates the random values via a Javascript call to rnorm(), and JavaScript creates the content to put in the two frames, computing the mean as it iterates over the values creating the text for the top-right frame.
  • barFrames1.html
    This is much the same as barFrames.html above but adds a text field in which the user can specify the sample size.
  • call.html
    Uses the call() method of the Java front-end to the R interpreter to invoke a function with an array of arguments.
  • call1.html
    Same as call above, but avoids creating the array of arguments by calling one of the special case call() methods directly.
  • eval
    A simple display with two text areas for input and output of S commands. One can click on an expression presented in a list to evaluate it.
  • call2
    This extends call1 by rounding the value using R's round() function. The number of digits used in the rounded value is controlled by a another text field at the user's disposal.
  • call3
    Extending call3, this uses an <SELECT> tag (rather than a text field) to provide the user with a way of specifying the number of digits in the rounding operation. This is more involved because of the way one has to retrieve this setting from the menu.
  • fromRframes
    Calls a function in R which then writes directly into a document in a Netscape frame. This illustrates how R can access JavaScript objects and their methods. The function is defined in showRnorm.R
  • objectsFrames
    Displays the current R search path, and set of objects within an element of the search path for this session, and each individual object on demand. It allows updating/refreshing and allows for dynamically selecting which element in the search path to view and which object within a package to view.
  • Rinput
    A simple front end to R in which one can execute commands and display the results, with a visual history list for re-invoking previous commands, and also a search path and object list browser. This also provides a dynamically generated interface to the R options() list.
    This example shows the relative simplicity and flexibility of using HTML, JavaScript and R.
  • shelpFrames
    The start of an interface for navigating the collection of R packages and displaying the contents of the index of each of these packages, with links to the help pages for those entries.
  • complexSlider.html
    This is an example of using Java, JavaScript and R together. It uses 3 sliders to specify the parameters for sampling from a normal distribution.

    Tests

  • namedList
    Tests converting a named list to a JavaScript object.
    optionList
    Test converting the named list returned from the S function options() to a JavaScript object and displaying it in a dialog box.

  • Duncan Temple Lang <duncan@research.bell-labs.com>
    Last modified: Tue Apr 3 10:51:13 EDT 2001