[R] making a neat timetable

mikalzet@libero.it mikalzet at libero.it
Fri Aug 17 10:33:13 CEST 2001


On Fri, 17 Aug 2001, Patrick Connolly wrote:

> |> 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:
>
> No, it doesn't have any column names.  It would be a good idea to get
> it into one since dataframes are very good ways of manipulating this
> kind of data.

I've found out it does actually:

> str(prova)
`data.frame': 66 obs. of 5 variables:
$ weekday: int 1 2 3 4 5 6 1 0 0 0 ...
$ start  : num 21 21 21 21 8 21 20 21 21 ...
$ end    : num 32 32 32 32 32 20 32 32 32 ...
$ type   : chr "reper" "reper" reper" "reper" ...
$ user   : chr "stf" "cal" "bas" "pup" ...


> |> prova[2] actually represents the weekday from Monday to Sunday
>
> I think you mean prova[,2] which is the second column (i.e. once
> you've got it into a datframe form).

Yes of course.

> That's tricky.  It might be a good idea to get some experience with
> simpler tasks first.  Check out aggregate.data.frame which should get
> most of it sorted for you.  Then you'll need to get the hang of
> pasting various vectors together.

Thanks for the hint.

> The trickiest part is the last one you mention.  It's pointless to
> discuss it until you get the rest of it work.  I have a rather long
> function that you could use once you get things organised, but it's
> far too long to go into how that works here.

> |> vertical rows corresponding to the weekday prova[2] (again with
>
> By that, I take it you mean "columns"

Yes !

I'll let you know how I fare ... although work will be suspended as from
tomorrow for a week's holidays.

-- 
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