[R] How to replace strings in data frames by condition

sakko sakko.saul at gmx.de
Fri Sep 18 20:55:38 CEST 2015


Hi,
this is my first post in this forum and I am new to Ra. I am desperately
seeking for help.

There is a data frame given in which I want to replace some values like
following:

Existing data frame:    
                   q_1_SQ009
1                              4
2                           <NA>
3                              3
4                              2
5   5: Stimme voll und ganz zu
6                              4
7                              4
8                              2
9   1: Stimme überhaupt nicht zu

Wanted data frame:
                       q_1_SQ009
1                              4
2                              0
3                              3
4                              2
5                              5
6                              4
7                              4
8                              2
9                              1

This means that every "<NA>", "5: Stimme voll und ganz zu" and "1: Stimme
überhaupt nicht zu" shall be replaced by 0, 5, 1


I beg you all for any help.... please

Many thanks in advance



Robert





--
View this message in context: http://r.789695.n4.nabble.com/How-to-replace-strings-in-data-frames-by-condition-tp4712469.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list