# Medical Audit New Column based off three other columns

#### SeanWestbury

##### New Member
Hello I'm Sean a final year medical student doing an audit on some ultrasound data. I'm new to programming and R.

What I want to do is create a column of data based off the values in three other columns. I have attached a picture to refer to because its a bit difficult to describe

So I have an Excel document with 320 patients and I have values for their ICA psv (cm/s), EDV (cm/s) and St Marys Ratios. What I want to do is calculate the percentage stenosis. To find the percentage stenosis(how clogged the artery is) requires any 2 of these 3 variables to be in the same row as the table I attached.

So I want to have a column where each cell says the degree of stenosis eg 50-59% which would mean 2 or 3 of the 3: 1) ICA psv (cm/s)>125, 2) EDV (cm/s)<100 and 3) St Marys Ratio is 8-10

Would anyone have any idea on how to achieve this. Sorry in advance I know its very hard.

Kind Regards Sean

#### rogojel

##### TS Contributor
hi,
a simple trick in R would be to apply the as.numeric() function to each logical condition and sum them , like as.numeric(ICA>125) + as.numeric(EDV<125) + as.numeric(StMary) == 2 or (>=2)

regards.