Greetings,

I am creating a standalone executable script using Rscript and have run
into problems when I define a new S4 class. Here is a small script that
demonstrates my problem:

#!/usr/bin/env Rscript
#
# toy.Rscript -- testing S4 class creation in an Rscript

setClass("toy",
  representation(name = "character",
                 price = "numeric"),
  prototype(name = "ball",
            price = 10.0)
)

b <- new("toy")
print(b)

When I make this script executable and run it I get the following error:

$ ./toy.Rscript
Error: could not find function "setClass"
Execution halted

Here is the relevant version information:

$ Rscript --version
R scripting front-end version 2.14.0 (2011-10-31)

I am in the process of developing a set of S4 classes that I will
eventually put into a package. I have been developing interactive scripts
that can source the S4 class files without any problem. But now that I want
to build a small command line 'wrapper' around my code I find that Rscript
is not aware of "setClass".

Any suggestions?

Jon

-- 
Jonathan Callahan, PhD
Mazama Science
206-708-5028
mazamascience.com

	[[alternative HTML version deleted]]

