Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201945

Making a new column in R populated from another column, and conditional on two other columns

$
0
0

I need to make a new column (col.4) that is populated with values from an existing column (col.2) chosen as a condition of the original neighboring column (col.1) and the same values in a new (longer) neighbor column (col.3). How can this be achieved? The data would look something like this:

col.1 col.2 col.3 col.4 1 A 1 A 2 B 2 B 3 C 2 B 4 D 3 C - - 1 A - - 4 D - - 3 C - - 4 D


Viewing all articles
Browse latest Browse all 201945

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>