Re: [R] loop through columns in a data frame

2019-03-26 Thread Yuan, Keming (CDC/DDNID/NCIPC/DVP) via R-help
0 1 1 1 2 3 3 3 1 1 0 1-10 of 10 rows | 1-10 of 11 columns Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Mon, Mar 25, 2019 at 10:08 AM Yuan, Keming (CDC/DDNID/NCIPC/DVP) via R-help mailto:r-he

[R] loop through columns in a data frame

2019-03-25 Thread Yuan, Keming (CDC/DDNID/NCIPC/DVP) via R-help
Hi All, I have a data frame with variable names like A_le, A_me, B_le, B_me, C_le, C_me if A_le=1 or A_me=1 then I need to create a new column A_new=1. Same operation to create columns B_new, C_new... Does anyone know how to use loop (or other methods) to create new columns? In SAS, I can