On Fri, 23 Mar 2007, Dirk Eddelbuettel wrote:

> Nit 1: read.csv() is for csv files which tend to have "," as a separator;
> read.table() is more useful here.

Well, that's correct.  read.csv was just a leftover from former
tests and finally it worked also this way - but thanks for the
hint anyway.

>> mydata <- read.table(file="/tmp/mydata.dat", sep="\t", header=TRUE)
>> mydata
>        date value1 value2
> 1 01.03.2007     17     42
> 2 02.03.2007      2      3
> 3 03.03.2007     47     11
>> mydata$date <- as.Date(mydata$date, "%d.%m.%Y")   ## [1]

Ahhh, the '$date' thingy did the trick!

> [1] As I mentioned, you need to supply a format unless your data lists as
> (for today) 2007-03-23 which is an ISO format

That's obvious.

> [2] The with() simply makes the indexing easier. Direct use is
> plot(mydata$date, mydata$value1) or also
> plot(mydata[,"date"], mydata[,"value1"]) or also
> plot(mydata[,1], mydata[,2])

Ahh, so many ways to do it right.  You must be really unlucky
if you manage to do it wrong as I did. ;-)

> [3] See the help for all the options on png, as well the numerous examples
> for plot to annotate, give titles, ...
>
> [4] dev.off() is critical to get the 'device' (here a file) closed.

Yea, read this in the docs.  Now I can start fine tuning and start
having fun with R. ;-)

> My pleasure. Happy R-ing,  Dirk

Thanks for the nice kick-start

           Andreas.

-- 
http://fam-tille.de

______________________________________________
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