# [R] Problem with col

Sarah Goslee sarah.goslee at gmail.com
Mon Apr 20 18:40:59 CEST 2015

```What is the problem? One or more of your columns was read as factor, as

str(data)

would show you. To avoid this, you can add stringsAsFactors=FALSE to
the read.table command, but if you expect your data to be entirely
numeric then there's something wrong with it that you need to hunt
down.

Sarah

On Mon, Apr 20, 2015 at 12:33 PM, Sonia Amin <soniaamin5 at gmail.com> wrote:
> Dear All,
>
> I have written the following lines:
>
> = FALSE, sep = "")
>  colnames(data)<-c("Consommation","Cylindre","Puissance","Poids")
>  result.model1<-lm(Consommation~Cylindre+Puissance+Poids, data=data)
> summary(result.model1)
>
> I obtained the following message:
>
>
> Call:
> lm(formula = Consommation ~ Cylindre + Puissance + Poids, data = data)
>
> Residuals:
> Error in quantile.default(resid) : factors are not allowed
> In Ops.factor(r, 2) :
>   ‘^’ This is not relevant for factors
>
>
> Where is the problem?