
Hi I don't want to ignore the date row.
See basically my first row is the date column and the 1st column is the
stocks name.
Now using the if loop I have to find prices of stocks corresponding to a
date.
I hope the problem is clear to you now

For example


Stocks	 30-Jan-08	 28-Feb-08	 31-Mar-08	 30-Apr-08	
a	 1.00	 3.00	 7.00	 3.00	
b	 2.00	 4.00	 4.00	 7.00	
c	 3.00	 8.00	 655.00	 3.00	
d	 4.00	 23.00	 4.00	 5.00	
e	 5.00	 78.00	 6.00	 5.00	


Rahul Agarwal
Analyst
Equities Quantitative Research
UBS_ISC, Hyderabad
On Net: 19 533 6363




-----Original Message-----
From: Gustaf Rydevik [mailto:gustaf.rydevik@gmail.com]
Sent: Tuesday, October 07, 2008 2:19 PM
To: Agarwal, Rahul-A
Cc: R-SIG-robust@r-project.org; r-help@r-project.org
Subject: Re: [R] Reading Data

On Tue, Oct 7, 2008 at 10:36 AM,  <Rahul-A.Agarwal@ubs.com> wrote:
>
> Hi,
> I have a data in which the first row is in date format and the first
> column is in text format and rest all the entries are numeric.
> Whenever I am trying to read the data using read.table, the whole of
> my data is converted in to the text format.
>
> Please suggest what shall I do because using the numeric data which
> are prices I need to calculate the return but if these prices are not
> numeric then calculating return will be a problem
>
> regards
>
> Rahul Agarwal
> Analyst
> Equities Quantitative Research
> UBS_ISC, Hyderabad
> On Net: 19 533 6363
>

Hi,

A single column in a data frame can't contain mixed formats.
In the absence of example data,  would guess one of the following could
work :

1)
read.table("data.txt",skip=1, header=T) ## If you have headers

2)
read.table("data.txt", header=T) ## If the date row is supposed to be
variable names.

3)
 read.table("data.txt",skip=1) ## If there are no headers, and you want
to ignore the date


regards,

Gustaf

--
Gustaf Rydevik, M.Sci.
tel: +46(0)703 051 451
address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik



	[[alternative HTML version deleted]]

