[R] making a neat timetable

mikalzet@libero.it mikalzet at libero.it
Thu Aug 16 10:06:14 CEST 2001


Sorry for the very primitive question ...

R 1.3.0 on linux Mandrake 8.

I have been experimenting with a program called phpSched
which is quite handy in preparing complicated job schedules,
but unfortunately produces totally inadequate printed output.
The data are stored in a MySQL table, and I can read them
into R with RMySQL obtaining a MySQLResultSet object (which I
suppose is a data frame ?) which looks like this:

>prova
1	0    8	20   Sac_m    mil
2	0    8  20   reper    arc
3	3    14 21   Ch_PN_p  cal
4       2    20 32   N-Med_PN alz

etc. for about 70 rows.

prova[2] actually represents the weekday from Monday to Sunday
(0 to 6), prova[3] the hour at which the shift starts and [4]
ends (where 32 must be changed to 32-24 to give 8), prova[5] is
the type of shift and [6] the identifier of the one on duty.

My aim is to produce a neat output table with horizontal rows
corresponding to prova[5] (but with different labels, of course)
and in cases where more than one shift time is present for
prova[5] with an additional horizontal row for each shift time ...

e.g.
	Lunedì	Martedì	Mercoledì

Sacile
8 - 14	   alz	   cal     bas

Sacile
14 - 20    nar     tro     fmg

Pordenone
int
8 - 14     arc             etc. etc.

Pordenone
int
14 - 20

Pordenone
int
20 - 8

vertical rows corresponding to the weekday prova[2] (again with
a human readable label). Some boxes will be empty as some shifts
are not present every day.

I thought this ought to be pretty straightforward but it isn't
(for me). My aim is to write a single function which will do
everything from reading in the MySQL table to printing the final
table (I can't expect the one who will be using this to learn R
... at most he'll switch on the printer and write R something).

I know I have to read a lot of documentation, any help will be
appreciated (at the moment I'm not even managing to order prova
by [2] and [3]).

-- 
Dr. Michele Alzetta


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list