[R] Numeric data not numeric in .csv file
Jeff Newmiller
jdnewmil at dcn.davis.CA.us
Wed May 2 05:28:48 CEST 2012
Sounds like you have some text in your csv file. Open it with a text editor and look at it. Some common problems are: alphabetic or symbol characters, spaces, quotes around numbers. Also watch out for blank rows or columns.
Read the Posting Guide (mentioned at the bottom of every post). Tips: The dput function is useful for generating an unambiguous representation of your data, which is key in getting correct advice around here. The head function can be used to chop off a short amount of data if you have a lot. The str function is good for troubleshooting your own issues.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.
Eve Proper <eproper at gmail.com> wrote:
>I am a raw novice to R, playing around with a mini .csv dataset created
>in
>Excel. I can read it in and the data looks OK in Excel and upon initial
>inspection in R:
>
>hikes <- read.csv("/Users/eproper/Desktop/hikes.csv", header=TRUE)
>print(hikes)
>
>does exactly what it is supposed to do.
>
>Two of the variables are genuine strings, but the others ought to be
>numeric, and R will calculate their min, max etc. However, is.numeric
>returns FALSE for all of them; storage.mode returns "language."
>as.numeric
>returns "Error: 'pairlist' object cannot be coerced to type 'double'."
>In
>what I suspect is a related problem, any command that calls for a
>variable
>name requires an initial ~ to work. That is, instead of plot(miles) I
>have
>to use plot(~miles).
>
>No doubt there is some very elementary mistake I am making, but I can't
>figure it out. Any help would be appreciated.
>
><http://theturducken.blogspot.com/>
>
> [[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.
More information about the R-help
mailing list