[R] Changing values

J Dougherty jwd at surewest.net
Mon Aug 4 05:00:15 CEST 2008


On Sunday 03 August 2008 01:54:43 pm Andrew Ramsey wrote:
> Hello--
>
> I am a relatively new user to R and I cannot find the information I
> need. Please help.
>
> I have a very large data set with values including letters, numbers,
> and symbols (sometimes within the same vector value [ie X9-].
>
> I've imported the data using read.fwp and it arrives in list format.
>
> I'd like to change the letters and symbols to numbers (ie X9-  ->
> 00911) in every entry.
>
> How would you recommend I try to do so?
>
> Thank you!
>
Andrew,

Your information is a little sparse, which limits how helpful list members can 
be.  What is the purpose to recoding the values?  By "read.fwp" did you 
mean "read.fwf" as in fixed-wdith format?  Looking at your "before" 
and "after" example, the leading zeros in the "after" example value would 
seem to mean the value is STILL an alphanumeric string rather than a "number" 
per se.  It might order more neatly in a printout than common ascii, but it 
is really no different and should still be a list.  As a rule, I would 
recommend handling tasks related to data coding in a dbms such as PostgreSQL 
or Access.  It is afterall what they are for.

John



More information about the R-help mailing list