I'm not a huge fan of using R's ts class directly, much preferring to use zoo or xts (both of which are packages) to enhance. That said, I think your problem comes from identifying the data/variable name incorrectly. You've only "ts"ed dados, but you try to plot divliq.pib; try
plot(dados[,"divliq.pib"]) instead. To get the names functionality, add the optional argument names= to the ts() call. If you go to xts, the following should work just fine for you: library(xts) dados<-read.csv("dadosR3.csv", header=T) dados<-xts(dados[,-1], as.Date(dados[,1])) # Assuming your date was in the left hand column Now dados will have its names inherited from the header of the CSV and you can plot them directly as plot(dados[,"divliq.pib"]) Hope this helps, Michael Weylandt On Mon, Oct 17, 2011 at 5:23 PM, Iara Faria <iarag...@yahoo.com.br> wrote: > Dear R helpers, > > I am a beginner at R so please be gentle :) > I have already read manuals and FAQs, with no help. > I have a monthly time series data on public debt with 40 variables, it starts > on January 1994 and ends on June 2011. > I am loading the data into R using read.csv and the data looks ok when I do > edit(dados): >> dados<-read.csv("dadosR3.csv", header=T) > then I tried making it into a time series object, using: >> dados2<-ts(dados, start = c(1994,1), frequency=12) > > Now when I try plotting any of the variables, for example divliq.pib (net > debt), the date doesn't appear on the x axis. How can I do this? > I use >> plot.ts(divliq.pib) > > also the function names() doesn't work, which would be important since I have > so many variables. >> names(dados2) > NULL > > I am using R.2.13.1 > > Thank you very much. > [[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. > > ______________________________________________ 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.