On 21-05-2013, at 13:16, shyam basnet <[email protected]> wrote:

> Dear R-Users,
>  
> While reading a GDX file from GAMS-software, the R-program does not read the 
> string (text) observations. Instead, it assigns some numerical values to each 
> text. Do you have some idea on how to read string observations?
>  
> Example in GDX file:
>  
> fid     out   year   value
> 1_2_3   RICE  1995   130.54
> 1_2_3   WHEAT 1996   115-40

Is the 115-40 correct?

> 1_2_4   RICE  1995   120.20
> 1_2_4   WHEAT 1996   115.40
>  
> But, the R-software reads the above data as:
>  
> fid        out     year     value
> 2721   10281   2155   130.54
> 2721   10284   2156   115-40
> 2726   10281   2155   120.20
> 2726   10284   2156   115.40
>  
> I want read the GDX file in as it is condition. 

You have not shown which function you have used to read in the file.
If you have used read.table or one of the alternatives:

?read.table

and look at argument stringsAsFactors: set it to FALSE. The strings have been 
treated as factors.

Berend

______________________________________________
[email protected] 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.

Reply via email to