Hi!

Thanks for your reply.

Indeed, I'm on Linux.

I tried to do what you said, but nothing happened.

I made a file called First.R in my work directory. It contains this code

.First<-function(){
  source("First.R")
  source("client.r")
  cat("it worked.")
}

I then source("First.R"), ok. and quit R.
WhenI restart, nothing happens - maybe because I didn't save the image?

But I don't want to have to save the image, I want to make a dynamic startup
of R with a file loaded, and execute a function call.

I alse tried this approach:

$ R < file.r

it seems to load, almost, then R quits.

Any ideas?

Thanks for your help in any case!
GF.

On 10/24/06, Leeds, Mark (IED) <[EMAIL PROTECTED]> wrote:
>
> You can have a .First function in the directory you are working in ( put
> The function in a file called First.R for ease of remembering )  or a
> .Profile file in your
> Home directory. I couldn't tell if you were on windows or linux.
>
> In either case, have the line  source("Rprogram.R") in either of the
> above and that source will be loaded when
> You start R. If you do it using First.R, you have to source("First.R")
> once in the
> Directory you are working in in order for it to know for the next time
> and any time after that.
>
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Grateful Frog
> Sent: Tuesday, October 24, 2006 1:17 PM
> To: r-help@stat.math.ethz.ch
> Subject: [R] How to start R with a file loaded?
>
> Hi!
>
> I've made great progress in my R programming, but I am again stuck on a
> beginner's problem.
>
> I would like to start R with a command line that loads a file, and if
> possible, executes a function.
>
> Can anyone  give me an example of how to do this?
>
> For example, in lisp, I would say:
>
> $ lisp -load toto.lisp -eval '(do-something $PORT)'
>
> to load the file "toto.lisp", then evaluate the expression with the
> shell envt variable bound properly.
>
> I'd like to do this in R, but can't figure it out!
>
> Thanks,
> GF.
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> --------------------------------------------------------
>
> This is not an offer (or solicitation of an offer) to buy/sell the
> securities/instruments mentioned or an official confirmation.  Morgan
> Stanley may deal as principal in or own or act as market maker for
> securities/instruments mentioned or may advise the issuers.  This is not
> research and is not from MS Research but it may refer to a research
> analyst/research report.  Unless indicated, these views are the author's and
> may differ from those of Morgan Stanley research or others in the Firm.  We
> do not represent this is accurate or complete and we may not update
> this.  Past performance is not indicative of future returns.  For additional
> information, research reports and important disclosures, contact me or see
> https://secure.ms.com/servlet/cls.  You should not use e-mail to request,
> authorize or effect the purchase or sale of any security or instrument, to
> send transfer instructions, or to effect any other transactions.  We cannot
> guarantee that any such requests received via e-mail will be processed in a
> timely manner.  This communication is solely for the addressee(s) and may
> contain confidential information.  We do not waive confidentiality by
> mistransmission.  Contact me if you do not wish to receive these
> communications.  In the UK, this communication is directed in the UK to
> those persons who are market counterparties or intermediate customers (as
> defined in the UK Financial Services Authority's rules).
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to