Quantcast

How do I convert only specific characters into numeric values in R?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How do I convert only specific characters into numeric values in R?

args
This post has NOT been accepted by the mailing list yet.
Hi,

R tells me that the numbers in this matrix are characters. I can convert them into numeric values. However, when I do so, the other characters are converted into NA (by coercion). How do I avoid this coercion? How do I keep these characters that are converted into NA in their original form?

Any help greatly appreciated.


                A                  B  
Location    First   Second  First   Second
       1       8.5     5.8       6.5     7
                8        5          7       6.5
                8.8     6          7.5     7
                9        6          7       7.2
                8.5     5          6.5     6.3
                C                  D  
       2       9.5     8        7.5       6.7
                8.8     8.2     8        7
                9       8.5      7.5      7
                9.3     8.3     7        6.8
                9.3     8        7         5.7
Loading...