All,
I am trying to learn how to write scripts in S-PLUS 6 for Linux and am
finding that the documentation explaining how to do this is lacking, to
say the least. The Programmer's Guide says to use the source() function
to run a script, which is essentially a text file created with one's
editor of choice. I like vi (no comments please).
At first, I created a file directly on the Linux system in my working
.Data directory called test.scr. It contained 2 simple commands that
work in the Commands Window on Linux (*and* in an S-Plus 2000 for
Windows (on my PC) script):
DirTable.1102 <- table(T1102.10.54f$Dir,T1102.10.54f$Hour)
PdirTable.1102 <- table(T1102.10.54f$Pdir,T1102.10.54f$Hour)
I then tried to run test.scr with the source command in the following
formats and got the following errors:
> source(test2.scr)
Problem: Object "test2.scr" not found
Use traceback() to see the call stack
> source("test2.scr")
Problem in parse(n = n, file = file): Couldn't open file "test2.scr" for
"r" (read): No such file or directory
Use traceback() to see the call stack
I figured I was missing something, so I tried invoking vi() in the
Commands Window and found that the following worked:
>test.scr <- vi("test.scr")
I got a vi editor window, inserted the 2 commands into the file, and
saved it. This is what it looked like and what happened when I tried to
source() it:
> test.scr
[1] "DirTable.1102 <- table(T1102.10.54f$Dir,T1102.10.54f$Hour)"
[2] "PdirTable.1102 <- table(T1102.10.54f$Pdir,T1102.10.54f$Hour)"
> source(test.scr)
Warning messages:
1: only the first of 2 elements used for string value in:
c("DirTable.1102 <-
table(T1102.10.54f$Dir,T1102.10.54f$Hour)", ....
2: only the first of 2 elements used for string value in:
c("DirTable.1102 <-
table(T1102.10.54f$Dir,T1102.10.54f$Hour)", ....
Problem in parse(n = n, file = file): Couldn't open file "DirTable.1102
<- table(T1102.10.54f$Dir,T1102.10.54f$Hour)" for "r" (read): No such
file or directory
Use traceback() to see the call stack
> source("test.scr")
Problem in parse(n = n, file = file): Couldn't open file "test.scr" for
"r" (read): No such file or directory
Use traceback() to see the call stack
Since the writing and running of scripts on the Windows version of
S-PLUS is much more intuitive and well documented, I find this
tremendously frustrating. This basic function should be documented more
thoroughly in the UNIX/LINUX version, and should be easy to find using
the index in the manuals and the online help. I'm having difficulty
finding anything other than a couple of sentences on scripts anywhere.
Can someone guide me in the right direction so that I can write and run
scripts on the Linux version? I would use my Windows version, but my
data files and analysis output are way too huge for my current
configuration. I need the space and memory afforded by our Linux
system. Thank you for your help.
*************************************************
Winifred C. Lambert Senior Scientist/Meteorologist
ENSCO, Inc.
Aerospace Sciences and Engineering Division
1980 N Atlantic Ave, Suite 230
Cocoa Beach, FL 32931
VOICE: 321.853.8130 FAX: 321.853.8415
lambert.winifred@ensco.com
AMU Quarterly Reports are available online:
http://science.ksc.nasa.gov/amu/home.html
*************************************************
|