You are right. The df is as follows:
   
  >df[1]
   
              V1
1        11.08
2         7.08
3         7.08
4         6.08
5         6.08
6         6.08
7        23.08
8        32.08
9         8.08
10       11.08
11        6.08
12       13.08
13       13.83
14       16.83
15       19.83
16        8.83
17       20.83
18       17.83
19        9.83
20       20.83
21       10.83
22       12.83
23       15.83
24       11.83

  But when I provide df[,1] it prints as earlier in factor form. How do I take are of this (factor) issue. 
   
  TIA
   
  Sachin
   
  
Prof Brian Ripley <ripley@stats.ox.ac.uk> wrote:
  On Mon, 26 Jun 2006, Sachin J wrote:

> I am trying to convert a dataset (dataframe) into time series object 
> using ts function in stats package. My dataset is as follows:
>
> >df
> [1] 11.08 7.08 7.08 6.08 6.08 6.08 23.08 32.08 8.08 11.08 6.08 13.08 13.83 16.83 19.83 8.83 20.83 17.83
> [19] 9.83 20.83 10.83 12.83 15.83 11.83

No data frame will print like that, so it seems that your description and 
printout do not match.

> I converted this into time series object as follows
>
> >tsdata <- ts((df),frequency = 12, start = c(1999, 1))

>From the help page for ts:

data: a numeric vector or matrix of the observed time-series
values. A data frame will be coerced to a numeric matrix via
'data.matrix'.

I suspect you have a single-column data frame with a factor column.
Look up what data.matrix does for factors.

> The resulting time series is as follows:
>
> Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
> 1999 2 15 15 14 14 14 12 13 16 2 14 5
> 2000 6 8 10 17 11 9 18 11 1 4 7 3
>
> I am unable to understand why the values of df and tsdata does not 
> match. I looked at ts function and I couldn't find any data 
> transformation. Am I missing something here? Any pointers would be of 
> great help.
>
> Thanks in advance.
>
> Sachin

> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
Brian D. Ripley, ripley@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595


 		
---------------------------------

	[[alternative HTML version deleted]]

