[R] Problem with converting F to FALSE

2013-09-05 Thread Venkata Kirankumar
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

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


Re: [R] Problem with converting F to FALSE

2013-09-05 Thread philippe massicotte
Look at "colClasses" in ?read.csv

> Date: Thu, 5 Sep 2013 18:14:49 +0530
> From: kiran4u2...@gmail.com
> To: r-help@r-project.org
> Subject: [R] Problem with converting F to FALSE
> 
> 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
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org 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.
  
[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


Re: [R] Problem with converting F to FALSE

2013-09-05 Thread arun
Hi,
Try:
dat1<-read.table(text="
sex  group
F   1
F   2
F   3
",sep="",header=TRUE,colClasses=c("character","numeric"))
 dat1
#  sex group
#1   F 1
#2   F 2
#3   F 3


#if you are using read.csv()
 
dat2<-read.csv("new1.csv",sep="",header=TRUE,colClasses=c("character","numeric"))
 dat2
#  sex group
#1   F 1
#2   F 2
#3   F 3


#Suppose you want to convert after reading it:
 dat2New<-read.csv("new1.csv",sep="",header=TRUE)
 dat2New[,1]<-substr(dat2New[,1],1,1)
 dat2New
#  sex group
#1   F 1
#2   F 2
#3   F 3
A.K.


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

__
R-help@r-project.org 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.


Re: [R] Problem with converting F to FALSE

2013-09-05 Thread Joshua Wiley
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
 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
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org 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.



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://joshuawiley.com/
Senior Analyst - Elkhart Group Ltd.
http://elkhartgroup.com

__
R-help@r-project.org 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.


Re: [R] Problem with converting F to FALSE

2013-09-05 Thread Keith Jewell

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
  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


__
R-help@r-project.org 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.


Re: [R] Problem with converting F to FALSE

2013-09-05 Thread Venkata Kirankumar
Thank you everyone
 I got actual values in my view




On Thu, Sep 5, 2013 at 7:31 PM, Keith Jewell
wrote:

> 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
>>   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
>>>
>>
> __**
> R-help@r-project.org 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.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.