If your data uses a special marker such as "--" or "n/a" to indicate not
available then once you have identified those markers (using any method, though
Don's procedure below is what I use) then you can specify them with the
na.strings parameter to read.csv. (See the help for read.table for many
Petr is almost certainly correct. A further suggestion:
Continue to import using stringsAsFactors = FALSE
On one of the columns that should be numeric, use as.numeric(), find the
NA's in the result of that, and then look at those rows of the data. There
will be something there that is non-numeric
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:
>
>
Hi
Your original numeric data probably contain something which prevents read.* to
accept them as numeric (decimal point, white space)
what is result of
str(imported.data)
Petr Pikal
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On B
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 e
5 matches
Mail list logo