[R] Error message 'x' must be numeric

Uwe Ligges ligges at statistik.tu-dortmund.de
Sat Aug 4 17:09:36 CEST 2012


On 04.08.2012 12:18, Ivette wrote:
> http://r.789695.n4.nabble.com/file/n4639158/elgas2.csv elgas2.csv
> http://r.789695.n4.nabble.com/file/n4639158/histogramselgas.R
> histogramselgas.R
>
> Hello,
>
> I want to plot 9 histograms, and I prepare the data for this operation with
> the usual command,
> sapply(x, is.numeric), then I get a confirmation that all data are numeric.
> Strangely, when I want to plot the histograms I get the error message:
> 'x' must be numeric. My  'x' is already numeric and I have no idea what's
> wrong.
> Could somebody tell me where the error is? I attach my .csv data and my R
> code.


You diverse x are data.frames rather than numeric vectors, just the 
columns of your data.frames are numeric.

Hence use, e.g., x1[,1] do access the first column of x1 etc.

Uwe Ligges


>
> Thank you.
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Error-message-x-must-be-numeric-tp4639158.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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