[R] Data Import to R

theo theosjp at gmail.com
Fri Nov 14 14:12:59 CET 2014


i think you can set: options(stringsAsFactor=FALSE)  which will apply
globally or use read.csv(..., stringsAsFactor=FALSE) when imporing.
have a look at the documentation ?read.csv
good luck.

On 11/14/2014 09:44 AM, David Winsemius wrote:
> 
> On Nov 13, 2014, at 4:28 PM, Ramesh Gautam wrote:
> 
>> While importing .csv files into R, all data are converted to factor-by
>> default. But, how can I preserve the original format of the data like
>> numeric to numeric, integer to integer, character to character etc while
>> importing from csv to R environment.
>>
>> I tried several ways, no thing helps. I used 'stringsAsFactor = FALSE'
>> command, it did convert all data to characters. But, I wanted to preserve
>> the numeric data to be in integer or double.
> 
> Use colClasses. And if that hint is not enough then post an example to work with.
>>
>> Any idea? examples?
>>
>> Thanks
>>
>> 	[[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at 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.
> 
> David Winsemius
> Alameda, CA, USA
> 
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list