From ripley at stats.ox.ac.uk  Sun Apr  8 15:07:46 2012
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Sun, 08 Apr 2012 14:07:46 +0100
Subject: [Rd] Display instruction text on package load
In-Reply-To: <CAOC91MTM+YPrsWhX4S31BRJcJ-YJddhGqXxZ8Oc4VngV31vWEQ@mail.gmail.com>
References: <CAOC91MTM+YPrsWhX4S31BRJcJ-YJddhGqXxZ8Oc4VngV31vWEQ@mail.gmail.com>
Message-ID: <4F818DA2.6000505@stats.ox.ac.uk>

On 07/04/2012 22:27, Thomas J. Leeper wrote:
> I'm currently working on a new package for R that interfaces with an API.
> Most of the package's functionality requires users to supply an access key
> that allows the package to work with the API. I want to display text
> immediately upon loading the package that instructs/reminds users to enter
> their access key before attempting to do anything (as the package won't
> really work without it). I've searched the relevant help files for creating
> packages but haven't been able find anything about how to do this. As an
> example, library(Zelig) does what I'm trying to achieve.
>
> Thanks for your help! And sorry if there's an obvious answer to this that I
> am oblivious to.
> -Thomas
>

?.onAttach
?packageStartupMessage

(You could also look at the sources for package Zelig, but actually it 
is a poor example since it ignores the arguments to .onAttach, and 
wastes time calling packageDescription() twice.)

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] Display instruction text on package load
Prof Brian Ripley