[R] Cleaning up messy Excel data

Stephen Sefick sas0025 at auburn.edu
Wed Feb 29 00:12:50 CET 2012


Just replace that value with zero.  If you provide some reproducible 
code I could probably give you a solution.
?dput
good luck,

Stephen

On 02/28/2012 03:27 PM, Noah Silverman wrote:
> Unfortunately, some data I need to work with was delivered in a rather messy Excel file.  I want to import into R and clean up some things so that I can do my analysis.  Pulling in a CSV from Excel is the easy part.
>
> My current challenge is dealing with some text mixed in the values.
> i.e.   118   5.7<2.0  3.7
>
> Since this column in Excel has a "<2.0" value, then R reads the column as a factor with levels.  Ideally, I want to convert it a normal vector of scalars and code code the "<2.0" as 0.
>
> Can anyone suggest an easy way to do this?
>
> Thanks!
>
>
> --
> Noah Silverman
> UCLA Department of Statistics
> 8117 Math Sciences Building
> Los Angeles, CA 90095
>
>
> 	[[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.

-- 
Stephen Sefick
**************************************************
Auburn University
Biological Sciences
331 Funchess Hall
Auburn, Alabama
36849
**************************************************
sas0025 at auburn.edu
http://www.auburn.edu/~sas0025
**************************************************

Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods.  We are mammals, and have not exhausted the annoying little problems of being mammals.

                                 -K. Mullis

"A big computer, a complex algorithm and a long time does not equal science."

                               -Robert Gentleman



More information about the R-help mailing list