Breaking up the task is an excellent way
of thinking.
John's solution is probably simplest in the
short run but not necessarily best in the
long run.
How I'd do it is write a function for each
of your three tasks and then have a script
to call the functions. There would be two
source files: one with the function definitions
and one with the script.
The advantage of functions is that they tend
to encourage breaking up tasks, and they are
more likely to be useful in more than one
instance. They help achieve long-term laziness.
Pat
On 04/11/2013 13:09, John Kane wrote:
Just type the commands in the Source window of RStudioo, debug, save as a .r
file and source it.
I don't see any particular reason to have three scripts once everything is
running correctly but you may find it useful.
John Kane
Kingston ON Canada
-----Original Message-----
From: csvirt...@gmx.de
Sent: Mon, 4 Nov 2013 09:34:54 +0100
To: r-help@r-project.org
Subject: [R] Newbie Question: Repeatable Tasks
Hello mailing list,
I am new to R using RStudio in Windows and I just want to have repeated
tasks each day but could not find an answer to that reading a lot of
intros,
scrolling through even more and reading on S.O.
I connect to a database, load data, do calculation, write results to the
database and close connection.
Can I save what I typed into the console as a script (I just figured how
to
type into the Source window)? My idea is to have three scripts (if
scripts
are the right way to do it): one for connection, second for calculation,
third to close connection. Would I then call them by "source(..R)" or is
there a click-button-solution?
I would really appreciate if someone guides me in the right direction
(link,
tutorial, example would be sufficient).
Thanks for your help
Chris
[[alternative HTML version deleted]]
______________________________________________
R-help@r-project.org 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.
____________________________________________________________
FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your
desktop!
______________________________________________
R-help@r-project.org 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.
--
Patrick Burns
pbu...@pburns.seanet.com
twitter: @burnsstat @portfolioprobe
http://www.portfolioprobe.com/blog
http://www.burns-stat.com
(home of:
'Impatient R'
'The R Inferno'
'Tao Te Programming')
______________________________________________
R-help@r-project.org 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.