R-alpha: R: `private' tree

Kurt Hornik (Kurt.Hornik@ci.tuwien.ac.at)
Tue, 3 Dec 1996 08:48:56 +0100


Date: Tue, 3 Dec 1996 08:48:56 +0100
Message-Id: <199612030748.IAA18061@aragorn.ci.tuwien.ac.at>
From: Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>
To: R-testers@stat.math.ethz.ch
Subject: R-alpha: R: `private' tree

I am not sure how useful others find this, but at our site we like the
idea of a private R tree (in our case, ~/lib/R) in addition to the
system-wide one (in our case, /usr/local/lib/R).

E.g., one can put *.input and *.doc files in ~/lib/R/data, and then load
the data files using data() and get documentation using ?data() etc.

Replacing RHOME/cmd/filename and RHOME/cmd/help with the scripts below
seems to do the job, without causing any problems ... at least for us.

Comments are welcome.

-k

*** RHOME/cmd/filename ***********************************************
#!/bin/sh

for file in $HOME/lib/R/$1/$2 $RHOME/$1/$2; do
    if [ -r $file ]
    then
	echo $file
	break
    fi
done

if [ ! -r $file ]
then
    echo
fi

*** RHOME/cmd/help ***************************************************
#!/bin/sh

pager=${PAGER-"more -s"}
subject=$1
shift
for d in $HOME/lib/R $RHOME;
do
    for i in $*
    do
	if [ -f "$d/help/$i/AnIndex" ];
	then
	    file=`grep "^$subject	" $d/help/$i/AnIndex`

	    if [ ! "x$file" = x ]
	    then
		file=$i/`echo $file | awk '{printf("%s", $2)}'`
		exec $pager $d/help/$file
	    fi
	fi	 
    done
done    
echo "sorry, no help for \"$subject\"."
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- For info or help, send "info" or "help",
To [un]subscribe, send "[un]subscribe"
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-