How to change a factor to numeric is FAQ 7.10
Also look at the `colClasses` argument to read.table/read.csv for a way to
specify the type of the column when you are reading it in.
On Mon, Nov 26, 2012 at 8:59 AM, EcoFranc wrote:
> Hi,
>
> maybe somebody would be kind enough to help a bloody an
EcoFranc,
di you remember to use the argument
header=TRUE
?
If not, the variable name is interpreted as data and will flip you into
factor rather than numeric.
On Mon, Nov 26, 2012 at 12:15 PM, jim holtman wrote:
> Also when reading a CSV file, if you do not want characters columns
> converted
Also when reading a CSV file, if you do not want characters columns
converted to factors, use 'as.is = TRUE' as one of the parameters. If
you have a column that is a factor, to convert it to numeric you have
to do the following:
as.numeric(as.character(factorColumn))
notice that you have to conv
Robert -- it may be that some of your factor variables cannot be
coerced to numeric because they have non-numeric elements.
This is why we ask for a reproducible example when posting. I
suspect just a few lines from the data frame would tell the story.
On 26-Nov-12, at 7:59 AM, EcoFranc wrot
Most likely there's something amiss in your csv file: R won't convert
numeric data to factors unless there are non-numeric characters
included.
First check your csv file for errors. If that doesn't solve your
problem, please provide a reproducible example.
http://stackoverflow.com/questions/596326
Hi,
maybe somebody would be kind enough to help a bloody and unprofessional
beginner like me (and I hope I did not overlook the answer to my question on
the website). I've imported a csv data frame into R, but I can't run a
regression because R interprets 4 out of 5 variables as factors (rather th
6 matches
Mail list logo