[R] Problem with converting F to FALSE

Keith Jewell keith.jewell at campdenbri.co.uk
Thu Sep 5 16:01:48 CEST 2013


Depending what you're doing with the data, you might want
     colClasses=c("factor","numeric")

On 05/09/2013 13:58, Joshua Wiley wrote:
> Hi,
>
> You can either manually specify colClasses or the asis argument.  See
> ?read.csv for more details.
>
> If you just had those two columns, something like:
>
>       read.table(header = TRUE, text = "
>       sex group
>       F 1
>       T 2
>       ", colClasses = c("character", "integer"))
>
> Cheers,
>
> Josh
>
>
> read.csv("file.csv", colClasses = c("character", "integer"))
>
>
>
>
> On Thu, Sep 5, 2013 at 5:44 AM, Venkata Kirankumar
> <kiran4u2all at gmail.com>  wrote:
>> Hi,
>> I have a peculier problem in R-Project that is when my CSV file have one
>> column with all values as 'F' the R-Project converting this 'F' to FALSE.
>> Can some one please suggest how to stop this convertion. Because I want to
>> use 'F' in my calculations and show it in screen. for example my data is
>> like
>>
>> sex  group
>> F       1
>> F       2
>> F       3
>>
>> but when I use read.csv and load the csv file data is converting it to
>>
>> sex          group
>> FALSE       1
>> FALSE       2
>> FALSE       3
>> but i want it as source data like
>>
>> sex group
>> F      1
>> F      2
>> F      3
>>
>>
>> Thanks in advance,
>> D V Kiran Kumar



More information about the R-help mailing list