Previous: Invocation, Up: Starting up


2.3 Small example

Here we present a very small example. Some other bigger examples can be found in the examples directory of the RPy distribution. See also Useful examples. If you want to contribute some code that you find interesting as an example of use, please, write to me (see Contact info and contributing).

This lines of code draw the density of a chi-squared distribution:

     >>> from rpy import *
     >>>
     >>> degrees = 4
     >>> grid = r.seq(0, 10, length=100)
     >>> values = [r.dchisq(x, degrees) for x in grid]
     >>> r.par(ann=0)
     >>> r.plot(grid, values, type='l')