What are you expecting to get? At the moment it appears that you are just ploting one data vector. table() is giving you a one row table.
BTW you probably should not use data as a data.frame name. It is a reserved word. John Kane Kingston ON Canada > -----Original Message----- > From: stude...@gmail.com > Sent: Thu, 16 Feb 2012 17:18:32 +0100 > To: r-help@r-project.org > Subject: [R] Multiple line-plot > > Hello everybody! > > I have again another newbie-question. I was trying to plot three curves > within one single > plot: Crime development (relative frequencies) according to the hours of > tv > consume per week (high/low/all together). > Here are the data: > > par(mfrow=c(1,1)) > # Data input > tvHrs<-c(21,22,23,24,25,26,27,28,21,22,23,24,25,26,27,28,2,3,4,5,6,7,8,9,10,11,12,13,14) > crimeDvp<-c(2,2,2,2,2,3,3,3,3,3,3,3,4,4,5,5,2,2,3,3,3,3,3,4,4,4,4,5,5) > > crimeDvp<-factor(crimeDvp, levels=1:5, > labels=c("strongly\nincreased","increased","equal","decreased","strongly\ndecreased"), > ordered=T) > data<-data.frame(tvHrs, crimeDvp) > > # Plotting lines > plot(prop.table(table(crimeDvp)), type='b', ylab='percent', xlab='crime > development') > legend("topright", inset=.05, title="TV consume", c("high","low","all"), > fill=c("red","black","green")) > > > I have experimented with the lines()-function, but couldnt do it. Thank > you > for any hints! > > David > > [[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. ____________________________________________________________ Share photos & screenshots in seconds... TRY FREE IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if1 Works in all emails, instant messengers, blogs, forums and social networks. ______________________________________________ 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.