[R] Reading Data

Gustaf Rydevik gustaf.rydevik at gmail.com
Tue Oct 7 10:48:36 CEST 2008


On Tue, Oct 7, 2008 at 10:36 AM,  <Rahul-A.Agarwal at 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



More information about the R-help mailing list